My apologies - I meant model but typed controller inadvertently.

On Nov 19, 7:18 am, David Roda <davidcr...@gmail.com> wrote:
> beforeSave is a model callback, not a controller call back.  It needs to go
> into your model
>
>
>
> On Wed, Nov 18, 2009 at 11:06 PM, jburns <jeremybu...@me.com> wrote:
> > Whenever I have used beforeSave in a controller (not sure if you are
> > using this in AppController?) I have called parent::beforeSave();
> > first. Really don't know if that will make a difference or not.
>
> > On Nov 19, 4:02 am, Dave <make.cake.b...@gmail.com> wrote:
> > > Ok now I have
>
> > > function beforeSave()
> > >          {
>
> > >                 return false;
> > >          }
>
> > > so it should fail automatically but it still saves. There has to be
> > > something very wrong.
>
> > > Any one have any ideas what so ever? This makes no sense what so ever.
>
> > > Dave
>
> > > On Nov 18, 9:05 pm, Dave <make.cake.b...@gmail.com> wrote:
>
> > > > I have :
>
> > > > function beforeSave()
> > > >       {
> > > >           App::import('Core', 'sanitize');
> > > >           $this->data = Sanitize::clean($this->data);
> > > >           return true;
> > > >       }
>
> > > > But no matter what I save nothing happens to the data.
>
> > > > Even tried adding this to the before save
>
> > > > function beforeSave()
> > > >       {
> > > >           App::import('Core', 'sanitize');
> > > >           $this->data = Sanitize::clean($this->data);
>
> > > >                 if(!empty($this->data))
> > > >                 {
> > > >                 $this->data['Award']['title'] = 'added from
> > beforeSave';
>
> > > >                 }
> > > >           return true;
> > > >       }
>
> > > > But still nothing.
>
> > > > Any ideas anyone?
>
> > > > On Nov 18, 2:40 am, Erik Nedwidek <nedwi...@lighthouseitc.com> wrote:
>
> > > > > Dave,
>
> > > > > No need to call the beforeSave method as it is a callback.
>
> > > > > function beforeSave() {
> > > > >   App::import('Sanitize');
> > > > >   $this->data = Sanitize::clean($this->data);
>
> > > > >   return true;
>
> > > > > }
>
> > > > > That should be all you need to do. Throw a couple of $this->log()
> > statements
> > > > > in there to verify the method is being called by Cake if you're not
> > sure.
>
> > > > > Erik Nedwidek
> > > > > Project Manager
> > > > > Lighthouse I.T. Consulting, Inc.
>
> > > > > On Tue, Nov 17, 2009 at 10:37 PM, Dave <make.cake.b...@gmail.com>
> > wrote:
> > > > > > Do you manually have to call beforeSave();
>
> > > > > > I have
> > > > > > function beforeSave()
> > > > > >  {
> > > > > >        $clean = new Sanitize();
> > > > > >        $this->data = $clean->clean($this->data);
> > > > > > return true;
>
> > > > > >  }
>
> > > > > > But it does nothing to the data.
>
> > > > > > What am I doing wrong?
>
> > > > > > Dave
>
> > > > > > --
>
> > > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > > > "CakePHP" group.
> > > > > > To post to this group, send email to cake-...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c
> > > > > >  om>
> > <cake-php%2bunsubscr...@googlegroups.c om>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/cake-php?hl=.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c 
> > om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=.

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=.


Reply via email to