Created
June 12, 2012 22:05
-
-
Save adrienbrault/2920420 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SELECT RELATION_ID(p.author) AS author_id | |
FROM Post AS p |
This file contains hidden or 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 FSC\Doctrine\DQL; | |
use Doctrine\ORM\Query\AST\Functions\FunctionNode; | |
use Doctrine\ORM\Query\Lexer; | |
use Doctrine\ORM\Query\Parser; | |
use Doctrine\ORM\Query\SqlWalker; | |
/** | |
* @author Adrien Brault <[email protected]> | |
*/ | |
class RelationId extends FunctionNode | |
{ | |
private $field; | |
public function parse(Parser $parser) | |
{ | |
$parser->match(Lexer::T_IDENTIFIER); | |
$parser->match(Lexer::T_OPEN_PARENTHESIS); | |
$this->field = $parser->AssociationPathExpression(); | |
$parser->match(Lexer::T_CLOSE_PARENTHESIS); | |
} | |
public function getSql(SqlWalker $sqlWalker) | |
{ | |
return $sqlWalker->walkPathExpression($this->field); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment