Php 在模型中使用请求参数进行转发/
有没有一种方法可以做一个前移Php 在模型中使用请求参数进行转发/,php,symfony1,symfony-1.4,doctrine-1.2,Php,Symfony1,Symfony 1.4,Doctrine 1.2,有没有一种方法可以做一个前移 lib/model/doctrine/table.class.php? 我有一个疑问。当查询返回带有$input的假转发时。或者有没有其他方法可以做到这一点 谢谢 Gunnar请勿在您的车型中执行此操作。。。在行动中做到这一点: $result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query $this->redirectIf(!$result, '@homepag
lib/model/doctrine/table.class.php?
我有一个疑问。当查询返回带有$input的假转发时。或者有没有其他方法可以做到这一点
谢谢
Gunnar请勿在您的车型中执行此操作。。。在行动中做到这一点:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
$this->redirectIf(!$result, '@homepage');
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
}
您也可以在操作中使用:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
$this->redirectIf(!$result, '@homepage');
或
你说的前进是什么意思?如果它重定向web浏览器,我们不在模型内部这样做,最好在动作层内部这样做