php - How to retrieve data from 2 database using doctrine in same entity-manager? -
i have problem in retrieve data 2 difference mysql databases
$em = $this->doctrine->emdetails; $qb = $em->createquerybuilder(); $qb->select('g.gradeid grade_id', 'g.gradename grade_name', 'g.rank', 'ay.academicid academic_year_id'); $qb->from('entity\grades', 'g'); $qb->leftjoin('g.academicyear', 'ay'); $qb->where('ay.academicid = :academicid'); $qb->setparameter('academicid', $data); $result = $qb->getquery()->getresult(); return $result;
academicyear
exist in x
database
, grades
exist in y
database
i have following error
base table or view not found: 1146 table 'y.academic_years' doesn't exist
how can solve problem
to query 2 different database need work 2 entity managers.
if you're working symfony can find how here :
http://symfony.com/doc/current/doctrine/multiple_entity_managers.html
official doc explains clearly.
Comments
Post a Comment