有没有办法在
中进行前进lib/model/doctrine/table.class.php?
我确实有查询。当查询返回带有$ input的false forward时。或者还有另一种方法可以做到。
谢谢!
贡纳尔
答案 0 :(得分:1)
请勿在您的模特中执行此操作...在您的操作中执行此操作:
action.class.php:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
if (!$result) // check if the result is false / empty
{
$this->forward('default','notfound'); // specify your forwarding module/action
or
$this->forward404(); // default 404 error
}
答案 1 :(得分:0)
您也可以在行动中使用:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
$this->redirectIf(!$result, '@homepage');
或者
$this->redirect404If(!$result, 'Your message');