Michael Villeneuve
Michael Villeneuve

Reputation: 4033

Doctrine - First letter is capital when exporting mysql

Something very weird/unusual happen when I export my SQL from my localhost to my server. For some reason Doctrine wants the same table but with the first letter being a capital letter.

For example, I have a table called "cart". It's always been that, never changed. On my localhost, the entity loads without any problem. I upload my Symfony2 projects, when I load my cart entity, doctrine throws an error saying "Cart" doesn't exist. If I change the table name to "Cart" it works.

It's the second project that this happen. Did anyone experience the same issue? If yes how did you solve it?


The error message is :

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'gentleme_pa2.Product' doesn't exist

And the annotation is :

/**
 * Product
 *
 * @ORM\Table('product')
 * @ORM\Entity
 */
class Product

Upvotes: 3

Views: 882

Answers (1)

Chase
Chase

Reputation: 9362

In your entity make sure you are using:

/**
 * @ORM\Entity
 * @ORM\Table(name="cart")
 */
class Cart
{
...
}

Upvotes: 3

Related Questions