symfony - How can order by FIELD in Symfony2 with doctrine -


hello worked symfony2 , doctrine.

i want order custom order doctrine

select id_product, pro_name product order field(id_product,3,5,2) 

i have tried

    $rang_1=array(3,5,2);     $products = $em->getrepository('companymybundle:product')->findby(array('public' => 1,'idproduct'=>$rang_1), array('idproduct'=>$rang_1), 5); 

and

$sql = $em->createquery("select p companymybundle:product p l.public = 1 , l.idproduct in (".implode(',',$rang_1).")  order field(l.idproduct,".implode(',',$rang_1).")")->setmaxresults(5); 

any suggestion?

i don't have experience order field-expression, have seen this post already? maybe can out?

seems they've written doctrine 2 extension handles implementation field...


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -