symfony - Get multi data from one entity with one method -
how can multiple data entity data row
public function findbyuser1id($userid) { $connections = $this->_em ->getrepository('appbundle:connectionslist') ->findby(array('user1id' => $userid)); foreach($connections $con) { $user = $this->_em ->getrepository('appbundle\entity\user') ->findoneby(array('id' => $con->getuser2id())); var_dump($user->getfirstname()); var_dump($user->getlastname()); var_dump($user->getemail()); var_dump($user->getid()); die; } }
i need way data in 1 row in example:
$user->get(array('firstname', 'lastname', 'email' ...))
i found solution, can't data in 1 row
code here:
public function findbyuser1id($userid) { $connections = $this->_em ->getrepository('appbundle:connectionslist') ->findby(array('user1id' => $userid)); foreach($connections $con) { $user = $this->_em ->getrepository('appbundle\entity\user') ->findoneby(array('id' => $con->getuser2id())); array_push($user, array( 'id' => $data->getid(), 'email'=>$data->getemail(), 'firstname'=>$data->getfirstname(), 'lastname'=>$data->getlastname() )); } return $data }
Comments
Post a Comment