@@ 39-48 (lines=10) @@ | ||
36 | } |
|
37 | } |
|
38 | ||
39 | public function lock() |
|
40 | { |
|
41 | /* @var $owner ActiveRecord */ |
|
42 | $owner = $this->owner; |
|
43 | ||
44 | $owner->{$this->lockedAttribute} = $this->valueLock; |
|
45 | if(!$owner->validate()) |
|
46 | throw new \yii\db\Exception('Error saving model! Validating not comlete: ' . implode('; ', $owner->firstErrors)); |
|
47 | $owner->save(); |
|
48 | } |
|
49 | ||
50 | public function unlock() |
|
51 | { |
|
@@ 50-60 (lines=11) @@ | ||
47 | $owner->save(); |
|
48 | } |
|
49 | ||
50 | public function unlock() |
|
51 | { |
|
52 | /* @var $owner ActiveRecord */ |
|
53 | $owner = $this->owner; |
|
54 | ||
55 | $owner->{$this->lockedAttribute} = $this->valueUnlock; |
|
56 | if(!$owner->validate()) |
|
57 | throw new \yii\db\Exception('Error saving model! Validating not comlete: ' . implode('; ', $owner->firstErrors)); |
|
58 | ||
59 | $owner->save(); |
|
60 | } |
|
61 | } |
|
62 |