We have answer of your question!

100% solved queries, no empty question

Question: Doctrine, escape variable field name in DQL


0

I have a DQL query like:

$em->createQuery("
    SELECT r
    FROM WeAdminBundle:FamilyRelation r
    WHERE r.col like :query
")

Now I want to change "col" depending on various parameters. How can i achieve this with DQL since the normal setParameter doesn't work here.

Question author Johni | Source

Answer


1


In short: you can't the way you want it.

To do it you'd need something like $dql->setColumn(array('variable_column' => 'some_column_name')) just as the bindColumn method from PDO, but there's no equivalent method (bindColum or setcolumn) in Doctrine.

Answer author Ast-derek

Tickanswer.com is providing the only single recommended solution of the question Doctrine, escape variable field name in DQL under the categories i.e sql , doctrine , dql , . Our team of experts filter the best solution for you.

Related Search Queries:


You may also add your answer

Thanks for contributing an answer to Tick Answer!