How to work with multiple Entity Managers and Connections in a same functions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to work with multiple Entity Managers and Connections in a same functions (/showthread.php?tid=74159) |
How to work with multiple Entity Managers and Connections in a same functions - surma - 08-06-2019 I am using Codeigniter 3 for my application and I created two database connections i.e Company and History. Now I want to make 2 queries where query 1 call company entity manager and second query call History Entity manager. These query should be called in one function where i get stuck here is my code $companies=$this->em->getRepository('comEntities\Company')->findAll(); $histories=$this->em->getRepository('HistoryEntities\History')->findAll(); This is the error which I get Message: require(C:\xampp\htdocs\myApp\application\models/companies\comEntities\Company.php):failed to open stream: No such file or directory Filename: third_party/ClassLoader.php Line Number: 181 RE: How to work with multiple Entity Managers and Connections in a same functions - InsiteFX - 08-06-2019 CodeIgniter Users Guide - Database Custom Result Objects RE: How to work with multiple Entity Managers and Connections in a same functions - php_rocs - 08-06-2019 @surma, Maybe this can assist you ... https://codeigniter.com/user_guide/database/connecting.html?highlight=database#connecting-to-multiple-databases RE: How to work with multiple Entity Managers and Connections in a same functions - surma - 08-07-2019 (08-06-2019, 07:48 AM)InsiteFX Wrote: CodeIgniter Users Guide - Database Custom Result Objects this is what i try and get tried to fetch record from 2 diff db $companies=$this->em->getRepository('comEntities\Company')->findAll(); $histories=$this->em->getRepository('HistoryEntities\History')->findAll(); This is the error which I get Message: require(C:\xampp\htdocs\myApp\application\models/companies\comEntities\Company.php):failed to open stream: No such file or directory Filename: third_party/ClassLoader.php Line Number: 181 RE: How to work with multiple Entity Managers and Connections in a same functions - surma - 08-07-2019 (08-06-2019, 07:55 AM)php_rocs Wrote: @surma, it does not work with dorctine orm RE: How to work with multiple Entity Managers and Connections in a same functions - InsiteFX - 08-07-2019 Try changing the single forward slash / in your require to a back slash \. RE: How to work with multiple Entity Managers and Connections in a same functions - surma - 08-07-2019 (08-07-2019, 03:43 AM)InsiteFX Wrote: Try changing the single forward slash / in your require to a back slash \. Still not working..is there any way to change entitymanager in a same function like we do for normal database,i.e. $this->load->database() |