CodeIgniter Forums
delete don't work - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Libraries & Helpers (
+--- Thread: delete don't work (/thread-16494.html)

delete don't work - El Forum - 03-08-2009

I am trying to delete one register but I can't get it. This is my code:
class my_class extends IgnitedRecord {
   public function delete($id)
        foreach( $rec as $message)

I check that $message is one row. I try this and after some seconds I get this message in Internet Explorer: "Internet Explorer cannot display the webpage".

Can any help me please?

delete don't work - El Forum - 03-11-2009

Did you tried this in Opera or Firefox?

Maybe contain more error info or other things.

delete don't work - El Forum - 03-16-2009

You end up in an infinite loop: controller -> my_class::delete() -> $message::delete() -> my_class::delete() -> $message::delete() -> ...
This because $message is tied to the my_class model, and according to the Data Mapper pattern is the model responsible for the deletion of the child objects ($message in this case), and you've overwritten the delete method (which $message::delete() calls).

To avoid this, why not just use $this->my_class->find($id)->delete(); ? (Or even AR, when it is so simple?)

delete don't work - El Forum - 03-22-2009

Thanks for the replyes. Yes I did a infinit bucle because in my function exist a delete method. I am sorry. Thanks. Now works fine.