1
$section = $objectManager->find('OEC\Entity\Section', $sectionId);
$class = $objectManager->find('OEC\Entity\Classes', $section->getClassId());
$cycle = $objectManager->find('OEC\Entity\Cycle', $class->getCycleId());
$branch = $objectManager->find('OEC\Entity\Branch', $cycle->getBranchId());
$sectionArr = $class->getClassName()." ".$section->getSectionName()." - ". $branch->getBranchName()." ".$cycle->getCycleName();
$objectManager->close();
我越來越Call to a member function getCycleId() on null
,但如果我print_r($variable);exit;
每個變量後,我得到的結果,直到年底,只有當我刪除它,它給我的錯誤。什麼是解決方案?調用一個成員函數上的空ZF2學說ORM 2
也許,你多次執行這個命令,'exit()'會在錯誤發生之前停止腳本。在'$ class = $ objectManager-> find [...]'後添加一個'if($ class === null){/ *在這裏添加調試信息*/die();}'。 –
它崩潰了,但如果我做print_r($ class); exit;相反,我得到一個正常的結果 – f0unix