Forward with request parameter in model/

117 Views Asked by At

Is there a way to do a forward in

lib/model/doctrine/table.class.php?

I do have a query. When the query returns a false forward with the $input. Or is there a another way to do it.

Thanks!

Gunnar

2

There are 2 best solutions below

0
On BEST ANSWER

Do not do this in your model ... do it in your action :

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
}

Symfony 1.4 docs on this subject

0
On

You can also use in your action :

$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
$this->redirectIf(!$result, '@homepage');

Or

$this->redirect404If(!$result, 'Your message');