symfony - Symfony2/Doctrine2 issue with query -
i getting weird response query messing things up. essentially, make call so
$allflights = $em->getrepository("nickalertbundle:alert")->getspecificalert($id); this calls following query
public function getspecificalert($id) { $active = "active"; return $this->getentitymanager() ->createquery( 'select a.id, a.searchcommand, group_concat(distinct c.classletter) classes, group_concat(distinct p.pseudo) pseudos, group_concat(distinct f.flightnumber) flight_number nickalertbundle:alert join nickalertbundle:bookingclass c a.id = c.availabilityalert join nickalertbundle:pseudos p a.id = p.availabilityalert join nickalertbundle:flightnumbers f a.id = f.availabilityalert a.alertstatus = :active , a.id = :id group a.id' ) ->setparameter('active', $active) ->setparameter('id', $id) ->getresult(); } now in database have 2 alerts. if var_dump response query, first alert
array(1) { [0]=> array(5) { ["id"]=> int(3) ["searchcommand"]=> string(12) "a20junlonmia" ["classes"]=> string(1) "i" ["pseudos"]=> string(7) "12d,4fd" ["flight_number"]=> string(6) "ay5507" } } now 1 processes fine. if output second alert following
array(1) { [0]=> array(5) { ["id"]=> int(8) ["searchcommand"]=> string(20) "@ba@a20aprlonnyc0100" ["classes"]=> string(1) "a" ["pseudos"]=> string(7) "12d,4fd" ["flight_number"]=> string(6) "ba1516" } } array(0) { } so empty array on end. there 1 alert id in database, not sure why happening. anyways, empty array causing following fail
$command = $allflights[0]['searchcommand']; is there reason why may receiving empty array particular query? seems occur command starts @.
thanks
Comments
Post a Comment