public function executeProductAllAccept()
{
$this->observation = ObservationPeer::retrieveByPK($this->getRequestParameter('id'));
$this->forwardUnless((
$this->observation
), 'observation', 'error');
$this->redirectUnless((
$this->product
), 'observation/error?flag=insufficientrights');
$currentTime = date('Y-m-d H:i:s');
//echo $currentTime.'<br />';
$this->observation->setIsSentBackToPM(0);
//echo 'after setIsSentBackToPM'.'<br />';
$this->observation->setIsPartAccepted(0);
//echo 'after setIsPartAccepted'.'<br />';
$this->observation->setIsHold(1);
//echo 'after setIsHold'.'<br />';
$this->observation->setCostAllAcceptanceTime($currentTime);
//echo 'after setCostAllAcceptanceTime'.'<br />';
$this->observation->save();
//echo 'after save'.'<br />';
//exit;
return $this->redirect('observation/myObservations');
}
此代码返回空白页面。在开发环境中尝试 - &gt;再次空白页面。
所以我添加了一些回声来测试它在哪里失败了。输出是:
2013-06-03 10:40:20
after setIsSentBackToPM
after setIsPartAccepted
after setIsHold
after setCostAllAcceptanceTime
因此,当执行save()时,这显然会失败。
查看symfony日志:
查看apache错误日志 - &gt;没有错误。
所以我尝试重建保存方法 - &gt; symfony推进式构建模型。但问题仍然存在。我将BaseObservation的保存方法与其他模型的保存方法进行了比较 - &gt;我没有看到任何异常。
我不知道如何追踪它。有什么想法吗?
编辑:更新测试:
public function executeProductAllAccept()
{
$this->observation = ObservationPeer::retrieveByPK($this->getRequestParameter('id'));
echo 'before test plain save'.'<br />';
$this->observation->save();
echo 'after test plain save'.'<br />';
$this->forwardUnless((
$this->observation
), 'observation', 'error');
$this->redirectUnless((
$this->product
), 'observation/error?flag=insufficientrights');
$currentTime = date('Y-m-d H:i:s');
echo $currentTime.'<br />';
$this->observation->setIsSentBackToPM(0);
echo 'after setIsSentBackToPM'.'<br />';
$this->observation->setIsPartAccepted(0);
echo 'after setIsPartAccepted'.'<br />';
$this->observation->setIsHold(1);
echo 'after setIsHold'.'<br />';
$this->observation->setCostAllAcceptanceTime($currentTime);
echo 'after setCostAllAcceptanceTime'.'<br />';
$this->observation->save();
echo 'after save'.'<br />';
exit;
return $this->redirect('observation/myObservations');
}
返回:
before test plain save
after test plain save
2013-06-03 10:40:20
after setIsSentBackToPM
after setIsPartAccepted
after setIsHold
after setCostAllAcceptanceTime
答案 0 :(得分:0)
好的,添加
error_reporting(E_ALL);
ini_set('display_errors',TRUE);
帮助解决问题。
在我的情况下,错误是:
Fatal error: Call to undefined method Observation::setCostAllAcceptanceTime() in /xxxxxxxxxxxxxx/modules/observation/actions/actions.class.php on line 792
似乎在更新的架构中的3行之间的某处丢失了。当我生成新模型时,没有生成方法setCostAllAcceptanceTime(和其他2个),导致错误。