If I run a delete query it runs ok. I made sure the user was able to delete from the table by running a delete query. Thanks for your help I am going to give cricket's suggestions a shot.
On Oct 26, 2010 4:24 PM, "Jeremy Burns | Class Outfit" <jeremyburns@classoutfit.com> wrote:
> Do you have referential integrity set up? If so, are there other records that are dependent upon this one? What happens if you try and delete the record directly in the database?
>
> Jeremy Burns
> Class Outfit
>
> jeremyburns@classoutfit.com
> http://www.classoutfit.com
>
> On 26 Oct 2010, at 14:18, cricket wrote:
>
>> On Tue, Oct 26, 2010 at 9:49 AM, shady <shady1024@gmail.com> wrote:
>>> Can you think of any reason a delete might not work? I know I have the
>>> correct ID and the proper permissions to delete records.
>>>
>>> Here's the code (obfuscated) from the controller:
>>>
>>> // load model
>>> $this->loadModel("MyModel");
>>
>> Why are you calling loadModel()? Does the controller not have it in
>> its $uses array? If you're in, eg. ThingsController, calling
>> loadModel() should be unnecessary.
>>
>>> // make sure we have correct ID - double checked this so I know it's
>>> right
>>> $this->log($thingToDel["Thing"]["id"], LOG_DEBUG);
>>> // delete record
>>> $this->MyModel->delete($thingToDel["Thing"]["id"]);
>>>
>>> I checked back in the database and the record I'm trying to delete is
>>> still there. What's another way I can debug this problem?
>>
>> What queries, if any, is Cake running? You probably don't have a view
>> for delete and instead do a redirect. If that's so, comment out the
>> redirect line and create a temporary delete.ctp. Set debug to 2, try
>> to delete your record, and then have a look at the SQL debug info.
>>
>>> Can I
>>> override the delete method in my model somehow? Thanks in advance for
>>> any help.
>>
>> Yes, of course.
>>
>> public function delete($id, $cascade = true)
>> {
>> // do something
>>
>> parent::delete($id, $cascade);
>> }
>>
>> Or, you could call parent::delete() first and do something after. But
>> that's not as likely as the record would already be gone. Depends on
>> what you need to do. The important thing is to somewhere call
>> parent::delete().
>>
>> 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 cake-php@googlegroups.com
>> 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?hl=en
>
> 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 cake-php@googlegroups.com
> 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?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.> Do you have referential integrity set up? If so, are there other records that are dependent upon this one? What happens if you try and delete the record directly in the database?
>
> Jeremy Burns
> Class Outfit
>
> jeremyburns@classoutfit.com
> http://www.classoutfit.com
>
> On 26 Oct 2010, at 14:18, cricket wrote:
>
>> On Tue, Oct 26, 2010 at 9:49 AM, shady <shady1024@gmail.com> wrote:
>>> Can you think of any reason a delete might not work? I know I have the
>>> correct ID and the proper permissions to delete records.
>>>
>>> Here's the code (obfuscated) from the controller:
>>>
>>> // load model
>>> $this->loadModel("MyModel");
>>
>> Why are you calling loadModel()? Does the controller not have it in
>> its $uses array? If you're in, eg. ThingsController, calling
>> loadModel() should be unnecessary.
>>
>>> // make sure we have correct ID - double checked this so I know it's
>>> right
>>> $this->log($thingToDel["Thing"]["id"], LOG_DEBUG);
>>> // delete record
>>> $this->MyModel->delete($thingToDel["Thing"]["id"]);
>>>
>>> I checked back in the database and the record I'm trying to delete is
>>> still there. What's another way I can debug this problem?
>>
>> What queries, if any, is Cake running? You probably don't have a view
>> for delete and instead do a redirect. If that's so, comment out the
>> redirect line and create a temporary delete.ctp. Set debug to 2, try
>> to delete your record, and then have a look at the SQL debug info.
>>
>>> Can I
>>> override the delete method in my model somehow? Thanks in advance for
>>> any help.
>>
>> Yes, of course.
>>
>> public function delete($id, $cascade = true)
>> {
>> // do something
>>
>> parent::delete($id, $cascade);
>> }
>>
>> Or, you could call parent::delete() first and do something after. But
>> that's not as likely as the record would already be gone. Depends on
>> what you need to do. The important thing is to somewhere call
>> parent::delete().
>>
>> 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 cake-php@googlegroups.com
>> 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?hl=en
>
> 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 cake-php@googlegroups.com
> 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?hl=en
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment