@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'title', |
| 66 | 66 | 'unique', |
| 67 | 67 | 'skipOnError' => true, |
| 68 | - 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != '.$this->id : '' |
|
| 68 | + 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != ' . $this->id : '' |
|
| 69 | 69 | ], |
| 70 | 70 | [ |
| 71 | 71 | [ |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | 21 | [ |
| 22 | - ['id'], |
|
| 22 | + [ 'id' ], |
|
| 23 | 23 | 'integer', |
| 24 | 24 | ], |
| 25 | 25 | [ |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | 21 | [ |
| 22 | - ['id'], |
|
| 22 | + [ 'id' ], |
|
| 23 | 23 | 'integer', |
| 24 | 24 | ], |
| 25 | 25 | [ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | 'title', |
| 68 | 68 | 'unique', |
| 69 | 69 | 'skipOnError' => true, |
| 70 | - 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != '.$this->id : '' |
|
| 70 | + 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != ' . $this->id : '' |
|
| 71 | 71 | ], |
| 72 | 72 | [ |
| 73 | 73 | [ |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $scenarios = parent::scenarios(); |
| 105 | 105 | |
| 106 | - $scenarios[self::SCENARIO_CREATE][] = 'about'; |
|
| 107 | - $scenarios[self::SCENARIO_UPDATE][] = 'about'; |
|
| 106 | + $scenarios[ self::SCENARIO_CREATE ][ ] = 'about'; |
|
| 107 | + $scenarios[ self::SCENARIO_UPDATE ][ ] = 'about'; |
|
| 108 | 108 | |
| 109 | 109 | return $scenarios; |
| 110 | 110 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function afterSave($insert, $changedAttributes) |
| 177 | 177 | { |
| 178 | - $this->linkWithAbout(empty($this->about) ? [] : $this->about); |
|
| 178 | + $this->linkWithAbout(empty($this->about) ? [ ] : $this->about); |
|
| 179 | 179 | |
| 180 | 180 | parent::afterSave($insert, $changedAttributes); |
| 181 | 181 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | 'name', |
| 40 | 40 | 'unique', |
| 41 | 41 | 'skipOnError' => true, |
| 42 | - 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != '.$this->id : '' |
|
| 42 | + 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != ' . $this->id : '' |
|
| 43 | 43 | ], |
| 44 | 44 | [ |
| 45 | 45 | [ |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | 21 | [ |
| 22 | - ['id'], |
|
| 22 | + [ 'id' ], |
|
| 23 | 23 | 'integer', |
| 24 | 24 | ], |
| 25 | 25 | [ |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | $count = (int)$this->db->createCommand('SELECT COUNT(*) FROM ' . $this->tableName)->queryScalar(); |
| 132 | 132 | |
| 133 | 133 | if ($count > 0) { |
| 134 | - $result = $this->db->createCommand('UPDATE ' . $this->tableName. ' SET ' . $this->queryUpdateAttributes()) |
|
| 134 | + $result = $this->db->createCommand('UPDATE ' . $this->tableName . ' SET ' . $this->queryUpdateAttributes()) |
|
| 135 | 135 | ->bindValues($this->attributesToBind()) |
| 136 | 136 | ->execute(); |
| 137 | 137 | } else { |
| 138 | - $result = $this->db->createCommand('INSERT INTO ' . $this->tableName. ' ' . $this->queryInsertAttributes()) |
|
| 138 | + $result = $this->db->createCommand('INSERT INTO ' . $this->tableName . ' ' . $this->queryInsertAttributes()) |
|
| 139 | 139 | ->bindValues($this->attributesToBind()) |
| 140 | 140 | ->execute(); |
| 141 | 141 | } |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | private function attributesToBind(): array |
| 154 | 154 | { |
| 155 | - $attributesToBind = []; |
|
| 155 | + $attributesToBind = [ ]; |
|
| 156 | 156 | |
| 157 | 157 | foreach ($this->getAttributes() as $name => $value) { |
| 158 | - $attributesToBind[':' . $name] = $value; |
|
| 158 | + $attributesToBind[ ':' . $name ] = $value; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return $attributesToBind; |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function queryUpdateAttributes(): string |
| 168 | 168 | { |
| 169 | - $toUpdateArray = []; |
|
| 169 | + $toUpdateArray = [ ]; |
|
| 170 | 170 | |
| 171 | 171 | foreach ($this->getAttributes() as $name => $value) { |
| 172 | - $toUpdateArray[] = $name . ' = :' . $name; |
|
| 172 | + $toUpdateArray[ ] = $name . ' = :' . $name; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | return implode(', ', $toUpdateArray); |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function queryInsertAttributes(): string |
| 182 | 182 | { |
| 183 | - $toInsertArrayNames = []; |
|
| 184 | - $toInsertArrayValues = []; |
|
| 183 | + $toInsertArrayNames = [ ]; |
|
| 184 | + $toInsertArrayValues = [ ]; |
|
| 185 | 185 | |
| 186 | 186 | foreach ($this->getAttributes() as $name => $value) { |
| 187 | - $toInsertArrayNames[] = $name; |
|
| 188 | - $toInsertArrayValues[] = ':' . $name; |
|
| 187 | + $toInsertArrayNames[ ] = $name; |
|
| 188 | + $toInsertArrayValues[ ] = ':' . $name; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | return |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | 'title', |
| 92 | 92 | 'unique', |
| 93 | 93 | 'skipOnError' => true, |
| 94 | - 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != '.$this->id : '' |
|
| 94 | + 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != ' . $this->id : '' |
|
| 95 | 95 | ], |
| 96 | 96 | [ |
| 97 | 97 | [ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'icon', |
| 59 | 59 | 'unique', |
| 60 | 60 | 'skipOnError' => true, |
| 61 | - 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != '.$this->id : '' |
|
| 61 | + 'filter' => $this->getScenario() == self::SCENARIO_UPDATE ? 'id != ' . $this->id : '' |
|
| 62 | 62 | ], |
| 63 | 63 | [ |
| 64 | 64 | [ |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $scenarios = parent::scenarios(); |
| 110 | 110 | |
| 111 | - $scenarios[self::SCENARIO_CREATE][] = 'contacts'; |
|
| 112 | - $scenarios[self::SCENARIO_UPDATE][] = 'contacts'; |
|
| 111 | + $scenarios[ self::SCENARIO_CREATE ][ ] = 'contacts'; |
|
| 112 | + $scenarios[ self::SCENARIO_UPDATE ][ ] = 'contacts'; |
|
| 113 | 113 | |
| 114 | 114 | return $scenarios; |
| 115 | 115 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function afterSave($insert, $changedAttributes) |
| 157 | 157 | { |
| 158 | - $this->linkWithContacts(empty($this->contacts) ? [] : $this->contacts); |
|
| 158 | + $this->linkWithContacts(empty($this->contacts) ? [ ] : $this->contacts); |
|
| 159 | 159 | |
| 160 | 160 | parent::afterSave($insert, $changedAttributes); |
| 161 | 161 | } |