mysql - How to use not mapped entity fields in query builder -
i have question. have entity has not mapped field type in it. how can use field in query builder building queries? problem since not mapped fields not available in mysql tables, cannot use them in sql queries directly. there way use them in doctrine query builder? ;)
you've got several options :
either map fields, ( why not ? that's doctrine for... :-) )
or use nativequery. docs here.
or use doctrine dbal , pass on query using prepare/execute/fetchall (this documented here). :
$sql = " select ... "; // query here $connection = $this->getdoctrine()->getmanager(); $qry = $connection->prepare($sql); $qry->execute(); $results = $qry->fetchall(); // can iterate through $results...
Comments
Post a Comment