php - symfony2 query builder with multiple databases (doctrine) -
i want join abteilung table in database other access data.
here right database abteilung:
$manager = $this->getdoctrine()->getmanager('olddb')->getrepository('chrisolduserbundle:bpdepartment');
and old query want change:
$result = $this->getdoctrine()->getrepository('kfzbuchungbundle:rent') ->createquerybuilder('r') ->addselect('abteilung') ->addselect('auto') ->join('r.auto','auto') ->join('r.abteilung','abteilung') ->where('r.mietestart >= :date_from') ->andwhere('r.mieteende <= :date_to') ->setparameter('date_from', $date_from) ->setparameter('date_to', $date_to) ->orderby('r.mietestart', 'asc') ->distinct() ->getquery()->getarrayresult();
i tried with:
$rsm = new resultsetmapping(); $rsm->addentityresult('chris\kfzbuchungbundle\entity\rent', 'bp'); $rsm->addentityresult('chris\bundle\olduserbundle\entity\bpdepartment', 'bp_dpt'); $rsm->addfieldresult('bp','id','id'); $query = $this->getdoctrine()->getmanager()->createnativequery('select * bp_department bp_dpt', $rsm); $result = $query->getresult();
but same shit, have no idea.
Comments
Post a Comment