Created
July 22, 2013 14:33
-
-
Save dfeyer/6054287 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace Ttree\Medialib\Analytics\Query\AST; | |
/* * | |
* This script belongs to the FLOW3 package "Ttree.Medialib". * | |
* * | |
* */ | |
use TYPO3\Flow\Annotations as Flow; | |
use \Doctrine\ORM\Query\AST\Functions\FunctionNode; | |
use \Doctrine\ORM\Query\Lexer; | |
class MysqlCeil extends FunctionNode { | |
public $simpleArithmeticExpression; | |
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) { | |
return 'CEIL(' . $sqlWalker->walkSimpleArithmeticExpression( | |
$this->simpleArithmeticExpression | |
) . ')'; | |
} | |
public function parse(\Doctrine\ORM\Query\Parser $parser) { | |
$lexer = $parser->getLexer(); | |
$parser->match(Lexer::T_IDENTIFIER); | |
$parser->match(Lexer::T_OPEN_PARENTHESIS); | |
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); | |
$parser->match(Lexer::T_CLOSE_PARENTHESIS); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$config = $this->entityManager->getConfiguration();
$config->addCustomNumericFunction('CEIL', 'Ttree\Medialib\Analytics\Query\AST\MysqlCeil');