1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +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 class AbsFunction extends FunctionNode
{ {
/**
* @var \Doctrine\ORM\Query\AST\SimpleArithmeticExpression
*/
public $simpleArithmeticExpression; public $simpleArithmeticExpression;
/** /**
@ -59,4 +62,3 @@ class AbsFunction extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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