When I following the steps in http://www.yiiframework.com/doc-2.0/guide-start-gii.html .
try to generate some CRUD operate for country table.
I following the details steps which tutorial told. but when I visit http://localhost/index.php?r=country%2Findex , I got below exception.
1 | The table does not exist: {{%country_search}} |
The reason why this exception throws. Because Yii2 assume there exist
country_search table in you MySQL, but if you look inside you code, the
CountrySearch extends from Country, so it should use the same table as Country
class. what you should do to fix this issue. you only need create a tableName
method to tell Yii2 which table name need to use.
1 | public static function tableName() |