Thursday, October 6, 2011

Re: Got a problem with delete()

Do you have any referential integrity (cart items, for example) that are preventing the delete at the db level? What happens if you delete the row directly at the db level?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 6 Oct 2011, at 11:26, heohni wrote:

Hi,

my users are able to save items to cart, and when I want to delete
them, I do a find to find the items id first:

$prid = $this->Bookmark->find('first', array('conditions' =>
array('mez_fkid_ben_id = '. $this->Auth->user('ben_id'),
'mez_fkid_obj_id = '. $id))); the passed $id is the item id.

And with this id I want to do the delete()
$this->Bookmark->delete($prid['Bookmark']['mez_id'])

But this statement never gets executed :-(
$prid['Bookmark']['mez_id'] has for sure a id number, which exists in
my table

I also can't see the statement, I see all others (debug=2) but not a
delete statement.
I have no redirect, I stay on the /delete/109 page.

Like the delete() ist just ignored....

function delete($id){
       if($this->Auth->user()){
           $this->Bookmark->recursive = -1;
           $prid = $this->Bookmark->find('first', array('conditions'
=> array('mez_fkid_ben_id = '. $this->Auth->user('ben_id'),
'mez_fkid_obj_id = '. $id)));
           $this->Bookmark->delete($prid['Bookmark']['mez_id']);
}
}


I don't get it....

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: