Duh. Thanks Brian.
-mike
On Apr 6, 8:41 am, brian 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
>
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
o
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
You are correct, model callbacks are not called for related models.
You will probably have to handle that in Member::afterDelete().
On Feb 25, 8:57 am, Deividas wrote:
> I have two controller's, for example Members and MemberPictures, when
> I delete Member i want MemberPicture also deleted, i
I have two controller's, for example Members and MemberPictures, when
I delete Member i want MemberPicture also deleted, i have set
MemberPictures dependable in Member model, but I also want to unlink
actual picture from the file system. I've tried using afterDelete() in
MemberPicture model, but i
Thanks for your suggestions, I've already got it working without
afterDelete.
Thanks.
On Sep 8, 9:26 am, alkemann <[EMAIL PROTECTED]> wrote:
> function delete($id = null) {
> if (!$id) {
> $this->Session->setFlash(__('Invalid id for Contact',
> tr
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for Contact',
true));
$this->redirect(array('action'=>'index'));
}
if ($this->Contact->del($id)) {
Hi,
there is no need to use the afterDelete event, because the delete
function of the model class gives a return value. Depending on the
return value you can set the flash message.
Pls. have a look at the API:
http://api.cakephp.org/class_model.html#680f1a7876f7be4d87308d4df3252e77
I hope this
Hey,
after I delete from a DB something I want to set a Flash message
saying if it's successfully been deleted or if there was an error.
I'm not sure how to implement this with afterDelete. Any ideas?
Thanks.
--~--~-~--~~~---~--~~
You received this message becaus