creocoder / yii2-taggable

The taggable behavior for the Yii framework.
Other
134 stars 33 forks source link

problem in beforeDelete #29

Open samirreza opened 6 years ago

samirreza commented 6 years ago

its better to check whether the owner model has error or not before reducing frequency and deleting all relations. because if some behaviors wants to attach error on owner and they registered before TaggableBehavior and reject deleting for some reasons, when deleting is perform the owner model stay live but all relations gone. something like this in beforeDelete() : if ($this->owner->hasErrors()) { return; } we can also think about doing this afterDelete event.