Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm FrozenObject Error
  • When trying to delete a record I get this error: Orm\FrozenObject [ Error ]: No changes allowed.
    I have these two models: class Model_Appointment extends Orm\Model
    {
    protected static $_properties = array('id', 'year', 'month', 'day', 'time', 'time_till');
    protected static $_has_many = array('attendants');
    } class Model_Attendant extends Orm\Model
    {
    protected static $_properties = array('id', 'appointment_id', 'username');
    protected static $_belongs_to = array('appointments');
    }
    My controller: class Controller_Appointments extends Controller
    {
    public function action_delete($id = null)
    {
    $appointment = Model_Appointment::find($id);
    if ( count($appointment->attendants) == 0 )
    {
    $appointment->delete();
    }
    }
    }
  • I think you found a bug, your code looks a lot like the code I've used to test the Orm code but still I think it's a bug. What happens is that you can "freeze" an object, which means it cannot be changed until you "unfreeze" it. This happens automaticly during saving/deleting to prevent loops between related objects. This error is shown when there's a relationship broken, that really shouldn't happen when there's no relations but that might just be the one case I didn't test properly. I'll look into it.
  • Ok. I'm also getting an error when deleting with $attendant->delete();
    When I remove $_belongs_to in Model_Attendant I don't get the error anymore. Also a bug?
  • I'm going to go out on a limb here and suggest this might just be related...
  • I created an issue in the bugtracker for this, any further updates will go there: http://dev.fuelphp.com/issues/97
This discussion has been closed.
All Discussions

Howdy, Stranger!

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

In this Discussion