yii2tech/ar-softdelete

Attributes set in beforeSoftDelete will not be saved , $attributes should init from $this->owner ?

hellowingy opened this issue · 1 comments

    protected function softDeleteInternal()
    {
        $result = false;
        if ($this->beforeSoftDelete()) {
            //$attributes = [];
            **$attributes = $this->owner->getAttributes();**
            foreach ($this->softDeleteAttributeValues as $attribute => $value) {
                if (!is_scalar($value) && is_callable($value)) {
                    $value = call_user_func($value, $this->owner);
                }
                $attributes[$attribute] = $value;
            }
            $result = $this->owner->updateAttributes($attributes);
            $this->afterSoftDelete();
        }
        return $result;
    }

Resolved by commit 8df3b9d