Aaron Belchamber
Aaron Belchamber

Reputation: 1698

FOS User Bundle Throwing Error in Symfony 2.5

I cannot get the FOS User Bundle to work in Symfony 2.5. It's probably so simple I'm overlooking something basic. I've used this bundle before without issues and cannot find a solution online. I have everything set up and can't clear the cache -- I get this error. It also displays the error on the browser. Please be advised I am only a few weeks into learning Symfony! I followed these instructions to the letter.

Here is the error I receive:

InvalidConfigurationException: Unrecognized options "0, 1, 2" under "fos_user"

What are the options "0, 1, 2" it is referring to? I thought maybe it was a routing issue, failing to bring in a query variable but I'm not sure.

Here is the relative part of config.yml:

imports:
  - { resource: parameters.yml }
  - { resource: security.yml }

fos_user:
  - db_driver: orm 
  - firewall_name: main
  - user_class: Main\Bundle\ToolsBundle\Entity\User

Yes, it's registered in the AppKernel.php:

new FOS\UserBundle\FOSUserBundle(),

User.orm.yml:

# Main/Bundle/ToolsBundle/Resources/config/doctrine/User.orm.yml
Main\Bundle\ToolsBundle\Entity\User:
    type:  entity
    table: fos_user
    id:
        id:
            type: integer
            generator:
                strategy: AUTO

The User.php entity is straight from the demo:

// Main/Bundle/ToolsBundle/Entity/User.php

namespace Main\Bundle\ToolsBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="fos_user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    public function __construct()
    {
        parent::__construct();
        // your own logic
    }
}

Upvotes: 0

Views: 593

Answers (1)

pazulx
pazulx

Reputation: 2379

Remove - from fos_user config(config.yml). It should look like this:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Main\Bundle\ToolsBundle\Entity\User

Upvotes: 2

Related Questions