Conditions | 3 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | protected function setFile($value) |
||
40 | { |
||
41 | if ($value instanceof UploadedFile) { |
||
42 | $this->_file = $value; |
||
43 | } else { |
||
44 | $this->_file = UploadedFile::getInstance($this->owner, $this->attribute); |
||
45 | } |
||
46 | $eventName = $this->owner->isNewRecord ? ActiveRecord::EVENT_BEFORE_INSERT : ActiveRecord::EVENT_BEFORE_UPDATE; |
||
47 | $this->owner->on($eventName, [$this, 'saveFile']); |
||
48 | } |
||
58 | } |