1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Fixed documentation for Doctrine\ORM\Query\AST\Functions

This commit is contained in:
Benjamin Morel 2012-12-13 10:42:25 +00:00
parent 42e83a2716
commit f743da0e02
15 changed files with 80 additions and 11 deletions

View File

@ -34,6 +34,9 @@ use Doctrine\ORM\Query\Lexer;
*/
class AbsFunction extends FunctionNode
{
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $simpleArithmeticExpression;
/**
@ -59,4 +62,3 @@ class AbsFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -39,6 +39,9 @@ class DateAddFunction extends FunctionNode
public $intervalExpression = null;
public $unit = null;
/**
* @override
*/
public function getSql(SqlWalker $sqlWalker)
{
switch (strtolower($this->unit->value)) {
@ -61,6 +64,9 @@ class DateAddFunction extends FunctionNode
}
}
/**
* @override
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);

View File

@ -36,6 +36,9 @@ class DateDiffFunction extends FunctionNode
public $date1;
public $date2;
/**
* @override
*/
public function getSql(SqlWalker $sqlWalker)
{
return $sqlWalker->getConnection()->getDatabasePlatform()->getDateDiffExpression(
@ -44,6 +47,9 @@ class DateDiffFunction extends FunctionNode
);
}
/**
* @override
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);

View File

@ -33,6 +33,9 @@ use Doctrine\ORM\Query\QueryException;
*/
class DateSubFunction extends DateAddFunction
{
/**
* @override
*/
public function getSql(SqlWalker $sqlWalker)
{
switch (strtolower($this->unit->value)) {

View File

@ -34,19 +34,40 @@ use Doctrine\ORM\Query\AST\Node;
*/
abstract class FunctionNode extends Node
{
/**
* @var string
*/
public $name;
/**
* @param string $name
*/
public function __construct($name)
{
$this->name = $name;
}
/**
* @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
*
* @return string
*/
abstract public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker);
/**
* @param \Doctrine\ORM\Query\SqlWalker $sqlWalker
*
* @return string
*/
public function dispatch($sqlWalker)
{
return $sqlWalker->walkFunction($this);
}
/**
* @param \Doctrine\ORM\Query\Parser $parser
*
* @return void
*/
abstract public function parse(\Doctrine\ORM\Query\Parser $parser);
}

View File

@ -64,4 +64,3 @@ class IdentityFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -59,4 +59,3 @@ class LengthFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -36,6 +36,10 @@ class LocateFunction extends FunctionNode
{
public $firstStringPrimary;
public $secondStringPrimary;
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression|bool
*/
public $simpleArithmeticExpression = false;
/**
@ -78,4 +82,3 @@ class LocateFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -59,4 +59,3 @@ class LowerFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -34,7 +34,14 @@ use Doctrine\ORM\Query\Lexer;
*/
class ModFunction extends FunctionNode
{
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $firstSimpleArithmeticExpression;
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $secondSimpleArithmeticExpression;
/**
@ -65,4 +72,3 @@ class ModFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -34,6 +34,9 @@ use Doctrine\ORM\Query\Lexer;
*/
class SizeFunction extends FunctionNode
{
/**
* @var \Doctrine\ORM\Query\AST\PathExpression
*/
public $collectionPathExpression;
/**
@ -118,4 +121,3 @@ class SizeFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -34,6 +34,9 @@ use Doctrine\ORM\Query\Lexer;
*/
class SqrtFunction extends FunctionNode
{
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $simpleArithmeticExpression;
/**
@ -59,4 +62,3 @@ class SqrtFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -35,7 +35,15 @@ use Doctrine\ORM\Query\Lexer;
class SubstringFunction extends FunctionNode
{
public $stringPrimary;
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $firstSimpleArithmeticExpression;
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression|null
*/
public $secondSimpleArithmeticExpression = null;
/**
@ -79,4 +87,3 @@ class SubstringFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -35,10 +35,26 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
*/
class TrimFunction extends FunctionNode
{
/**
* @var bool
*/
public $leading;
/**
* @var bool
*/
public $trailing;
/**
* @var bool
*/
public $both;
/**
* @var bool
*/
public $trimChar = false;
public $stringPrimary;
/**
@ -96,5 +112,4 @@ class TrimFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}

View File

@ -59,4 +59,3 @@ class UpperFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}