You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* @var bool
* whether to automatically set operation to OPERATION_MAKE_ROOT
* on saving new records, so you could use
* $model->save();
* instead of
* if ($model->isNewRecord) {
* $model->makeRoot();
* } else {
* $model-save();
* }
*/
public $makeRootOnInsert = false;
then in before insert
public function beforeInsert()
{
if ($this->makeRootOnInsert && !in_array($this->operation, [
self::OPERATION_MAKE_ROOT,
self::OPERATION_PREPEND_TO,
self::OPERATION_APPEND_TO,
self::OPERATION_INSERT_BEFORE,
self::OPERATION_INSERT_AFTER,
])) {
$this->operation = self::OPERATION_MAKE_ROOT;
}
/* ... */
}
The text was updated successfully, but these errors were encountered:
then in before insert
The text was updated successfully, but these errors were encountered: