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