Small fix

parent 80a4fe9a
...@@ -11,7 +11,7 @@ use yii\db\ActiveRecord; ...@@ -11,7 +11,7 @@ use yii\db\ActiveRecord;
* Class SoftDelete * Class SoftDelete
* *
* @package vendor\vyants\softdelete * @package vendor\vyants\softdelete
* @author Vladimir Yants <vyants@dengisrazy.ru> * @author Vladimir Yants <vladimir.yants@gmail.com>
* @property ActiveRecord $owner * @property ActiveRecord $owner
*/ */
class SoftDelete extends Behavior class SoftDelete extends Behavior
...@@ -51,8 +51,8 @@ class SoftDelete extends Behavior ...@@ -51,8 +51,8 @@ class SoftDelete extends Behavior
* @param Event $event * @param Event $event
*/ */
public function softDelete($event) { public function softDelete($event) {
if($this->timeAttribute) {
$attributes[0] = $this->timeAttribute; $attributes[0] = $this->timeAttribute;
if($attributes[0]) {
$this->owner->$attributes[0] = time(); $this->owner->$attributes[0] = time();
} }
...@@ -70,8 +70,8 @@ class SoftDelete extends Behavior ...@@ -70,8 +70,8 @@ class SoftDelete extends Behavior
* Restore soft-deleted record * Restore soft-deleted record
*/ */
public function restore() { public function restore() {
if($this->timeAttribute) {
$attributes[0] = $this->timeAttribute; $attributes[0] = $this->timeAttribute;
if($attributes[0]) {
$this->owner->$attributes[0] = null; $this->owner->$attributes[0] = null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment