Search code examples
symfonydoctrinesymfony-3.4

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


Solution

  • UPDATE:

    Found the solution. I had to write the table name in the Entity like this:

    @ORM\Table(name="`Somename`")
    

    Source:

    Doctrine - PostgreSQL - Uppercase and Spaces in Table / Field names