/library/DoctrineExtensions/Query/Mysql/Md5.php
PHP | 56 lines | 22 code | 9 blank | 25 comment | 0 complexity | ff95dc4106fd8e115b251c2095896532 MD5 | raw file
- <?php
- /*
- * DoctrineExtensions Mysql Function Pack
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to kontakt@beberlei.de so I can send you a copy immediately.
- */
- namespace DoctrineExtensions\Query\Mysql;
- use Doctrine\ORM\Query\Lexer;
- use Doctrine\ORM\Query\AST\Functions\FunctionNode;
- /**
- * "MD5" "(" StringPrimary ")"
- *
- * @category DoctrineExtensions
- * @package DoctrineExtensions\Query\Mysql
- * @author Andreas Gallien <gallien@seleos.de>
- * @license New BSD License
- */
- class Md5 extends FunctionNode
- {
- public $stringPrimary;
- /**
- * @override
- */
- public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
- {
- return $sqlWalker->getConnection()->getDatabasePlatform()->getMd5Expression(
- $sqlWalker->walkStringPrimary($this->stringPrimary)
- );
- }
- /**
- * @override
- */
- public function parse(\Doctrine\ORM\Query\Parser $parser)
- {
- $lexer = $parser->getLexer();
- $parser->match(Lexer::T_IDENTIFIER);
- $parser->match(Lexer::T_OPEN_PARENTHESIS);
- $this->stringPrimary = $parser->StringPrimary();
- $parser->match(Lexer::T_CLOSE_PARENTHESIS);
- }
- }