php - How to perform select where in array column - Symfony3 + Doctrine -


i have created entity symfony3 set field column in database array.

symfony saved db registers like:

id | name    | roles 01 | raphael | ["role_admin", "role_super_admin"]  02 | jose a. | ["role_admin"]  03 | marcos  | ["role_user"]  

how can perform select doctrine role_admin or role_user?

i`ll need create search many other situations... 1 easiest explain...

hope understand situation... thanks!

i solved problem using syntax:

$formdata = $form->getdata(); $em = $this->getdoctrine()->getmanager(); $usersrepository = $em->getrepository('appbundle:usuario'); $qb = $usersrepository->createquerybuilder('r'); $qb->select('a')     ->from('appbundle:usuario', 'a');  foreach($formdata $key => $value) {      foreach($value $k => $item){          $qb->andwhere("a.$key :it_$k")              ->setparameter("it_$k", '%'.$item.'%');      } } $result = $qb->getquery()->execute(); 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -