Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Getting Error! Orm\FrozenObject [ Error ]: No changes allowed. while deleting parent
  • while i deleting parent . i getting this error

    Error!



    Orm\FrozenObject [ Error ]:
    No changes allowed.


    when i checked, i found no issue with it. all has many has casecade delete set true, all belong_to has not set casecade delete, i getting error by deleting parent.


    Why this is happeing,.\I am asking, The real case why fuelphp shows this error?


  • i have found some solutions, and causes.

    one of the deleting table has after_load observer which checks parent table data and creating some custom property. I think the parent is deleted before child. the child is querying to somehow parents which exactly not exist. when i commentout the after_load observer.. the row is deleted.  ,any how.. this is the cause. any news?
  • Most common cause is incorrect definition of relations, i.e. the belongs_to is defined on the wrong model.

    Afaik the code deletes parents after children, because you would run into problems with database constraints if you do it the other way around. It does require the relation to be defined correctly.
  • Also,

    You get this error if you are trying to modify the object while it is in the process of being deleted. So your observers should check the frozen state before modifying them.

    if ( ! $model->frozen())
    {
        // change the object.
    }

Howdy, Stranger!

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

In this Discussion