php - How to reach a joined field with Symfony 2? -
i have joined query:
$query = $this ->getem() ->getrepository("movementheader") ->createquerybuilder('d') ->leftjoin('movementdetail', 'stockmovementdetail', 'with', 'stockmovementdetail.movementid = d.id')
now how reach "movementdetail" ?
since question vague i'm going answer generally. if want more specific information, please provide more specific information.
assuming movement header has field linked movementdetail entity (let's call movementdetail). following :
$query = $this ->getem() ->getrepository("movementheader") ->createquerybuilder('mh') ->select('mh','md') ->innerjoin('mh.movementdetail','md') ->where(/* in cause, can select ever want mh or md*/) ->setparameters(array(/* ... */))
here examples of can use :
->where('mh.id = :id') //could used when want retrieve specific header ->where('md.field in (:list)') // want retrive mh // (and md) contains fields
you can multiple conditions this
->where('mh.field = :value , md.otherfield = :value2')
and then, have set parameters accordingly.
once results can access fields normal getters , setters.
Comments
Post a Comment