0
當我嘗試檢查某個表是否已存在某個id時,出現此錯誤,但出現錯誤「調用成員函數getIdProcesoAcumulado()非對象」上在非對象上調用成員函數getIdProcesoAcumulado()
這是控制器:
public function AcumularAction($id){
$idAcumulado = $this->getRequest()->get('acumulado');
$em = $this->getDoctrine()->getEntityManager();
$proceso =$em->getRepository('ProcesoBundle:ProcesoDisciplinario')->find($id);
$acumulado = $em->getRepository('ProcesoBundle:ProcesoDisciplinario')->find($idAcumulado);
$existe = $em->getRepository('ProcesoBundle:ProcesoAcumulado')->find($idAcumulado);
$acum = new ProcesoAcumulado();
$existe->getIdProcesoAcumulado();
if(! $acumulado){
return new JsonResponse(array('exito' => false));
}else{
$acum->setIdProcesoAcumulado($acumulado);
$acum->setIdProceso($proceso);
//$acum->setNroInternoAcum();
$em->persist($acum);
$em->flush();
return new JsonResponse(array('exito' => true));
}
}
,這是GET:
/**
* Get idProcesoAcumulado
*
* @return integer
*/
public function getIdProcesoAcumulado()
{
return $this->idProcesoAcumulado;
}
嘗試'轉儲($ existe);'這可能是'NULL'。如果是這樣,這是因爲'$ em-> getRepository('ProcesoBundle:ProcesoAcumulado') - > find($ idAcumulado);'不返回所需的實體。 –