maybe you should get the information BEFORE you actually delete the
record

otherwise thats like trying to read a book on a ship you just threw
into the ocean...
there is no way of going back


On 25 Jul., 14:08, Abraham Boray <[email protected]> wrote:
> Thx dude, U rock ;)
> It's workin' :D
>
> Still how can i get the informations about the last deleted record! in
> a normal delete(not in callback function, is there any way ?
> EG:
>                 if ($this->Picture->delete($id)) {
> here get the last deleted picture informations !!!!
>
> }
>
> On Jul 24, 8:02 am, tristan_ph <[email protected]> wrote:
>
>
>
> > Abraham,
>
> > You should put the beforeSave function in the model, NOT in the
> > controller.
>
> > On Jul 24, 3:59 am, Abraham Boray <[email protected]> wrote:
>
> > > OOOps sorry guys, i have done a mistake
> > > Actually the beforeSave function is like this, I was just testing it
> > > that way(we never know, if it will work :D )
>
> > > function beforeSave() {// Correct one, but not working as well :(
> > >        exit();//stop the execution, just 2 see if the callback is
> > > called, :(
> > >         }
>
> > > On Jul 23, 7:55 pm, Abraham Boray <[email protected]> wrote:
>
> > > > I'm working on a project, which requires to do some file upload, this
> > > > last task works fine (I included a plugin)
>
> > > > But when it comes to the callback function after a delete for example
> > > > of a record, it doesn't work for some unknown reasons!
>
> > > > Example.
> > > > After a delete of an image record from the database, I gotta delete
> > > > the file as well from the web root directory.
> > > > the first part is working which is to delete the file from the DB, but
> > > > deleting the file from webroot is not, cause it's related delete code
> > > > resides in afterSave callback function ..
>
> > > > function admin_beforeSave() {
> > > >        exit();//stop the execution, just 2 see if the callback is
> > > > called, :(
> > > >         }
>
> > > > function admin_delete($id = null) {
> > > >                 if (!$id) {
> > > >                         $this->Session->setFlash(__('Invalid id for 
> > > > type', true));
> > > >                         $this->redirect(array('action'=>'index'));
> > > >                 }
> > > >                 if ($this->Type->delete($id)) {
> > > >                         $this->Session->setFlash(__('Type deleted', 
> > > > true));
> > > >                         $this->redirect(array('action'=>'index'));
> > > >                 }
> > > >                 $this->Session->setFlash(__('Type was not deleted', 
> > > > true));
> > > >                 $this->redirect(array('action' => 'index'));
> > > >         }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to