0
如何禁用教條2中的延遲加載?禁用懶加載教條zend框架?
$em = $this->getEntityManager();
$repo = $em->getRepository('Application\Entity\StudentClass');
$result = $repo->findBy(array('pkStudentClass' => '1'));
print_r($result);
我來這裏太多的數據和腳本失敗。
您將始終從原則中獲取對象。 '$ result'將是一個'Doctrine \ ORM \ PersistentCollection'(它負責延遲加載)。使用'$ result-> toArray()'返回集合中所有'Application \ Entity \ StudentClass'實體的'array'。 – AlexP
這是真的,謝謝。 – user3911183