We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Collections: beforeSave() is being fired on $my_document->delete()

I have found that beforeSave() is being fired when attempting to delete() a document.

Isn't this a bug or a known issue?



47.7k

I neglected to mention that my document has soft deleteable behaviour on it.

Does beforeSave() get executed on delete() with soft deleteable behaviour in Mvc\Models?

Soft delete performs update so it is correct



47.7k

Technically. But semantically?



47.7k
Accepted
answer
edited Mar '16

To branch blocks of validation code depending on the operation made I write within validation():

public funciton validation()
{
    if($this->_operationMade != 2) {
        ... // Validation code
    }
}