Ha, I know you'll all say... ahhhhh, you're breaking MVC so let me explain
the situation in case anyone cares to have it. But if you don't, I'm just
looking for the best way to force a redirect from a behavior. Preferably
without having to edit any other file.
ie. maybe something like ... myFunction () {
Controller::redirect('somewhere'); }
If you just can't stand someone breaking MVC, here's the story, so that
maybe you can tell me the MVC way to do it.
I have this behavior which is used by many different plugins. In
beforeFind() it filters results. If no results are found, I want to all of
the plugins that use this behavior to be redirected to a single specific
page. Its not something I would return to the controller, because then I
would have to edit a the multiple controllers, in multiple plugins for any
plugin that actsAs this behavior. And I wouldn't just do a beforeFilter
catch in AppController, because that would break plugin architecture - as
in they should be stand alone and separate from the App. So as simple as
it sounds, it seems its just not possible to do...
public function afterFind(&$Model, $results) {
if (empty($results)) :
$this->redirect('to somewhere else');
endif;
}
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php