craphunter
craphunter

Reputation: 981

Forward with request parameter in model/

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

Upvotes: 0

Views: 105

Answers (2)

startupz
startupz

Reputation: 21

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');

Upvotes: 0

Manse
Manse

Reputation: 38147

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

Upvotes: 1

Related Questions