public function beforeDelete()
    {
        /** @var BaseActiveRecord $owner */
        $owner = $this->owner;
        foreach ($this->_relationsCascadeDelete as $relationName => $params) {
            if ($params === true) {
                /** @var ActiveQuery $relation */
                $relation = $owner->getRelation($relationName);
                if (!empty($owner->{$relationName})) {
                    if ($relation->multiple === true) { // Has many relation
                        $this->_relationsToDelete = ArrayHelper::merge($this->_relationsToDelete, $owner->{$relationName});
                    } else {
                        $this->_relationsToDelete[] = $owner->{$relationName};
                    }
                }
            }
        }
    }
public function beforeDelete()
    {
        /** @var BaseActiveRecord $owner */
        $owner = $this->owner;
        foreach ($this->_relationsCascadeDelete as $relationName => $params) {
            if ($params === true) {
                /** @var ActiveQuery $relation */
                $relation = $owner->getRelation($relationName);
                if (!empty($owner->{$relationName})) {
                    if ($relation->multiple === true) { // Has many relation
                        $this->_relationsToDelete = ArrayHelper::merge($this->_relationsToDelete, $owner->{$relationName});
                    } else {
                        $this->_relationsToDelete[] = $owner->{$relationName};
                    }
                }
            }
        }
    }
public function beforeDelete ( ) { /** @var BaseActiveRecord $owner */ $ owner = $ this -> owner ; foreach ( $ this -> _relationsCascadeDelete as $ relationName => $ params ) { if ( $ params === true ) { /** @var ActiveQuery $relation */ $ relation = $ owner -> getRelation ( $ relationName ) ; if ( ! empty ( $ owner -> { $ relationName } ) ) { if ( $ relation -> multiple === true ) { // Has many relation $ this -> _relationsToDelete = ArrayHelper :: merge ( $ this -> _relationsToDelete , $ owner -> { $ relationName } ) ; } else { $ this -> _relationsToDelete [ ] = $ owner -> { $ relationName } ; } } } } }
Get the list of owner model relations in order to be able to delete them after its deletion
Get the list of owner model relations in order to be able to delete them after its deletion