| Conditions | 1 |
| Paths | 1 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | public function safeUp() |
||
| 9 | { |
||
| 10 | // set default value for `avatar` field to NULL |
||
| 11 | $tab = self::tn(self::TAB_USERS); |
||
| 12 | $this->alterColumn($tab, 'avatar', Schema::TYPE_STRING . "(45) DEFAULT NULL"); |
||
| 13 | // replace all empty `avatar` |
||
| 14 | $this->db->createCommand("update " . $tab . " set [[avatar]]=NULL where [[avatar]]=''")->execute(); |
||
| 15 | } |
||
| 16 | |||
| 24 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.