-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DATE function for PostgreSQL (#353)
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace DoctrineExtensions\Query\Postgresql; | ||
|
||
use Doctrine\ORM\Query\AST\Functions\FunctionNode; | ||
use Doctrine\ORM\Query\Lexer; | ||
|
||
/** | ||
* @author Steve Lacey <[email protected]> | ||
*/ | ||
class Date extends FunctionNode | ||
{ | ||
public $date; | ||
|
||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) | ||
{ | ||
return 'DATE(' . $sqlWalker->walkArithmeticPrimary($this->date) . ')'; | ||
} | ||
|
||
public function parse(\Doctrine\ORM\Query\Parser $parser) | ||
{ | ||
$parser->match(Lexer::T_IDENTIFIER); | ||
$parser->match(Lexer::T_OPEN_PARENTHESIS); | ||
|
||
$this->date = $parser->ArithmeticPrimary(); | ||
|
||
$parser->match(Lexer::T_CLOSE_PARENTHESIS); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters