Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error deleting
  • image
    can you explain this?
  • Pretty obvious.

    Your table schema defines classes_id as a required field (NOT NULL), and your value array for the insert doesn't contain a value.
  • yeah but can you give me a reason why there's an insert data?
    i just want to delete record
  • From the looks of it, your $xclasses object contains new related objects. So ORM will insert that first.

    The fact that you delete a parent doesn't directly mean you want to delete all related objects too. You need to enable cascade_delete on the relation if you want to automatically delete related child objects of that relation.
  • when i enable cascade_delete, is the ORM Model trigger observer delete when the child record deleted?
  • HarroHarro
    Accepted Answer
    No, you define it on the relation. So when you delete the parent, it will delete associated children.

    If you don't want that, it will have to reset the foreign key of all related childeren to NULL (since you are deleting the record the foreign key points to), which with your constraint will be a problem too.
  • HarroHarro
    Accepted Answer
    And it doesn't work recusive.

    So it will not delete the childeren's childeren, unless that relation also has a cascade_delete defined on it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion