driscan
driscan

Reputation: 23

Table doesn't exist within FOSUserBundle

I'm currently developing an administration interface with FOSUserBundle, but I'm facing an annoying issue:

I've created an Operator class to hold FOSUserBundle's users, which is mapped in Symfony2 using Doctrine ORM. The first letter of Operator is uppercase (the rest of the tables in the website are also prefixed with capital letters, so I didn't want to break that convention).

The issue is that when I log in my administration interface, an error pops saying:

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

Obviously, the query should use dbname.Operator, not dbname.operator.

Any help would be much appreciated.

Thanks!

Edit: attached the class definition of the Operator Entity:

/**
 * @ORM\Entity
 * @ORM\Table(name="Operator")
 */
class Operator extends BaseUser {

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

}

Upvotes: 0

Views: 1146

Answers (2)

Jon Winstanley
Jon Winstanley

Reputation: 23321

Have you run

doctrine:schema:update --force 

To create the database table?

Upvotes: 3

Jon Winstanley
Jon Winstanley

Reputation: 23321

You can set the database table name in your entity.

If you use annotations, your entity should start something like this:

/**
 * Operator 
 *
 * @ORM\Table(name="Operator")
 */
class Operator
{

Upvotes: 0

Related Questions