Symfony2:找不到基表或视图:1146

2022-01-03 00:00:00 php mysql symfony doctrine-orm

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

Hi, I"m working with a friend on a Symfony2 project. He's working on a Windows based computer and I'm on my Mac. We setup the project and made the database model / entities (code first) on his computer. Now I wanted to start working on it as well so we did a SQL dumb to my localhost. I edited the parameters.yml to match my settings. The project can connect to the server. But when I try to open a page where the database is used i get this error:

执行'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'时发生异常:

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]:未找到基表或视图:1146 表 'socialgeogroep6.District' 不存在500 内部服务器错误 - DBALException1 个链接异常:PDOException »

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

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


Just to be clear, the page is running normal on his computer; he gets the data as it should be.


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

What can be the problem? I looked in my PHPmyAdmin over and over again and the database is there with all the fields and data...
(screen: http://gyazo.com/4a0e5f1ee6b1e29d2d277df5fc0d8aac) I really can't imagine what the problem is.

希望有人能帮助我们!

推荐答案

这可能是一个案例问题.您的数据库中有 district 表,但学说要求的是 District 表.

It's likely a case issue. You have the district table on your database, but doctrine is asking for the District table.

您应该配置学说以使用小写的表名.参考学说文档 http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#persistent-classes 了解如何操作.

You should configure doctrine to use lower case table name. Refer to the doctrine documentation http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#persistent-classes to know how to do so.

相关文章