Im using Doctrine 2 ORM in my Zend project and need to serialize my Entities to JSON in several cases.
ATM i use the Querybuilder and join all tables i need. But my serializer causes doctrine to lazy load every associated Entity which results in pretty huge data amounts and provokes recursion.
Now im looking for a way to totally disable Doctrines lazy loading behavior.
My way to select data would be the following:
$qb= $this->_em->createQueryBuilder()
->from("ProjectEntityPersonappointment", 'pa')
->select('pa', 't', 'c', 'a', 'aps', 'apt', 'p')
->leftjoin('pa.table', 't')
->leftjoin('pa.company', 'c')
->leftjoin('pa.appointment', 'a')
->leftjoin('a.appointmentstatus', 'aps')
->leftjoin('a.appointmenttype', 'apt')
->leftjoin('a.person','p')
I would like my resultset to only contain the selected tables and associations.
Any help would be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…