使用Gii生成的CountrySearch不能使用的问题
2016-05-09 08:37
302 查看
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.
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.
I following the details steps which tutorial told. but when I visit http://localhost/index.php?r=country%2Findex, I got below exception.
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.
public static function tableName() { return "Country"; }
相关文章推荐
- Windows 下安装 Oracle 12c 教程
- Android布局的各种对齐问题
- sql计算时间差的datediff()函数怎么用
- 编写简单的中文分词程序
- 重载和重写
- CountDownLatch使用
- CountDownLatch使用
- C#农历源码
- 将博客搬至CSDN
- 柴俊理金:5月9号早间黄金、宁贵沥青操作策略
- C与C++程序的启动代码(startup)
- [剑指offer]平衡二叉树
- C#格式化数值结果表
- 关于xml和Json数据解析的一些总结
- php查询操作实现投票功能
- C#操作ACCESS数据库(创建,压缩,备份,恢复)
- 《麦肯锡卓越工作方法》
- xcodebuild
- Qt5+opencv程序打包发布
- Android layout学习笔记