Duh. Thanks Brian.

-mike

On Apr 6, 8:41 am, brian <bally.z...@gmail.com> wrote:
> It doesn't return anything because it's been deleted. Your model's ID
> may still be set but it no longer points to a row in the DB. So
> field() comes back empty.
>
> For your purposes, use beforeDelete(). The afterDelete() callback
> would be better used (AFAIK) where you need to, say, remove images or
> other files from the filesystem. With a cached file, it shouldn't be a
> big deal if it's removed but (for whatever reason) the model delete
> doesn't happen. That would suck with images or other files.
>
> On Mon, Apr 6, 2009 at 7:10 AM, Mike <mikerog...@gmail.com> wrote:
>
> > I have the following callback in my model:
>
> > public function afterDelete() {
> >        Cache::delete('client_' . $this->field('name'));
> > }
>
> > Although $this->id is set, the field function (or any similar
> > function, such as read(), find(), etc.) doesn't return any data. I've
> > had to resort to beforeDelete since it properly executes. Has anyone
> > run into this? Am I doing something wrong?
>
> > Thanks,
> > -mike
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to