symfony - Symfony: Doctrine cannnot find table with first letter Uppercase
问题描述
I have this database in which all tables have this format:
Somedata
and the names of the columns are like this:
UserInformation
Basically, the first letter is capitalized, and Doctrine cannot find the table/column
I tried adding a naming strategy:
naming_strategy: doctrine.orm.naming_strategy.underscore
But that didn't work.
I also tried to set MySQL lower case table names to 1
lower_case_table_names = 1
That didn't work as well. If I change all the names of the tables and columns to lowercase, works as expected. However, I cannot do that in the production database, so how can make Doctrine find the tables with that format?
By the way, the tables are already created, and I cannot modify them
解决方案
您在这里有 2 个选择:
- 实施自定义命名策略,您可以根据需要生成表名。检查文档Doctrine Naming Strategy
- 在每个实体中设置所需的表名:
@ORM\Table(name="SomeName")
推荐阅读
- r - 在R中获取伽马分布参数(尤其是位置参数)的MLE
- c# - 窗体重新获得焦点时的 Windows 窗体事件
- java - 更新到 Safari 12.0 - Java 插件不再列出
- javascript - 如何调用restfull webservice并传递JSON数据并以字符串形式获取响应
- javascript - 通过使用工具栏粘贴链接进行超文本处理
- android - 如何拆分其中包含 Ques 和 Answer 的 API 响应。我想将它拆分为expandableListView android
- three.js - blender export gltf 用于three.js - 不显示烟雾和颗粒
- jquery - 使用 .jsp 扩展名时 Jquery 不工作
- security - Docker 本地和共享网络
- reactjs - 使用带有联合类型的打字稿对 React 组件进行 Visual Studio Code 智能感知