php - Symfony2 : Base table or view not found: 1146

标签 php mysql symfony doctrine-orm

问题

你好,我正在和一个 friend 一起做一个 Symfony2 项目。他在一台基于 Windows 的电脑上工作,而我在我的 Mac 上工作。 我们设置了项目并在他的计算机上制作了数据库模型/实体(代码优先)。现在我也想开始研究它,所以我们对我的本地主机做了一个 SQL 哑巴。我编辑了 parameters.yml 以匹配我的设置。该项目可以连接到服务器。 但是当我尝试打开一个使用数据库的页面时,我得到了这个错误:

An exception occurred while executing 'SELECT t0.id AS id1, t0.name AS name2, t0.bigimage AS bigimage3, t0.smallimage AS smallimage4, t0.info AS info5, t0.city_id AS city_id6 FROM District t0':

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'socialgeogroep6.District' doesn't exist 500 Internal Server Error - DBALException 1 linked Exception: PDOException »

需要说明的是,该页面在他的电脑上运行正常;他得到了应有的数据。


问题

可能是什么问题?我一遍又一遍地查看我的 PHPmyAdmin,数据库中包含所有字段和数据......
(屏幕:http://gyazo.com/4a0e5f1ee6b1e29d2d277df5fc0d8aac) 我真的无法想象问题是什么。

希望有人能帮助我们!

最佳答案

这可能是一个案例问题。您的数据库中有 district 表,但 doctrine 要求使用 District 表。

您应该将 doctrine 配置为使用小写的表名。引用学说文档http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#persistent-classes知道怎么做。

关于php - Symfony2 : Base table or view not found: 1146,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14380154/

相关文章:

php - 未找到 Symfony 类

php - 错误 : Namespace declaration statement has to be the very first statement or after any declare call in the script

php - 使用 $_GET 查询 MySQL w/PHP 的回显结果

php - 如何解决这个约束错误

php - 找不到 Symfony ZipArchive PHP 扩展类

mysql - Doctrine Deployment don t fin pdo_mysql, on Synology with console-access

php - 在单个查询中使用一个 ID 插入多条记录

php - 共享主机上的 Laravel 5 - 错误的 public_path()

mysql - MySQL 是否在 Having 上使用索引?

MySQL UPDATE 与同一张表的 SUBQUERY