We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How can I skip Model event

Hi everyone. Does Phalcon provide any proper way to skipping Model event?

So, I want to call $entity_instance->update(); without firing beforeUpdate()

edited Jul '17

i cant remember if there was a native way of doing it

but ..

$model->_skipMe = true;
$model->update(); // public function ... { if $this->_skipMe === true $this->skipMe = false; return true  }

Thanks! That's what I was looking for!

But imagine my operation will be delete() instead of update() and my model has Soft Delete Behaviour and at the same time I need to skip beforeUpdate()

        'events' => false,

It canceled events and record will be removed from db instead of marked as archived Is there any native way out?

edited Jul '17

I don't think so. In that case you need to do update, changing value of flag column.