class News
{
...
/**
* @ORM\ManyToMany(targetEntity="Q\FilesBundle\Entity\File")
* @ORM\JoinTable(name="news_file_relation",
* joinColumns={@ORM\JoinColumn(name="news_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="file_id", referencedColumnName="id", unique=true)}
* )
*
* @ORM\OrderBy({"sort" = "ASC"})
*/
private $files;
}
/**
* MysqlInstrFunction ::= "INSTR" "(" str "," substr ")"
*/
class InstrFunction extends FunctionNode
{
public $str = null;
public $substr = null;
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->str = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$this->substr = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return 'INSTR(' .
$this->str->dispatch($sqlWalker) . ', ' .
$this->substr->dispatch($sqlWalker) .
')';
}
}