Yeah the redirect should be done from within the controller, models are more for dealing with data / queries. Placing this in your controller method should fix your issue, i.e. your admin_delete or delete method in the controller.
On 27 July 2014 09:44, Sam Clauw <i...@bellewaerdefun.be> wrote: > Hmmm, that doesn't work out for me. It seems that it tries to execute a > query: > > *Error: *SQLSTATE[42000]: Syntax error or access violation: 1064 You have >> an error in your SQL syntax; check the manual that corresponds to your >> MySQL server version for the right syntax to use near 'referer' at line 1 >> *SQL Query: *referer > > > This is my current AppModel: > > class AppModel extends Model { >> >> // soft delete functionaliteit >> >> public function beforeDelete() >> { >> if ($this->hasField('deleted')) { >> if ($this->saveField('deleted', date('Y-m-d H:i:s'))) { >> return $this->redirect($this->referer()); >> } >> } >> } >> } > > > I guess $this->redirect() should always been done in a controller? Or is > there a way to catch it in the model? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.