• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
delete don't work

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?

Did you tried this in Opera or Firefox?

Maybe contain more error info or other things.

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?)

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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.