2

I am using Symfony2 and when i try to append FOSUserBundle, but i got an error (bin/console doctrine:schema:update --force)

//---------------------------------------------------------------Appkernel.php

public function registerBundles()
{
    $bundles = [
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(),
        new main\kipeoBundle\kipeoBundle(),
        new FOS\UserBundle\FOSUserBundle(),

    ];

//----------------------------------------------------app/config/config.yml

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: main\kipeoBundle\Entity\User

//----------------------------------------src-main>kipeoBundle>Entity>User.php

namespace main\kipeoBundle\Entity;

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

/**
 * @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
    }
}

//----------------------------------------------------app/config/routing.yml

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"
5
  • What is the path of your bundle ? Is it src/main/kipeoBundle ? Otherwise, your structure is wrong. Commented Apr 4, 2016 at 12:57
  • [Doctrine\Common\Persistence\Mapping\MappingException] No mapping file found named 'User.orm.xml' for class 'main\kipeoBundle\Entity\User'. Commented Apr 4, 2016 at 13:02
  • 1
    Possible duplicate of Symfony2 Error: No mapping file found named Commented Apr 4, 2016 at 13:04
  • are you using yml format for you other entities ? Commented Apr 4, 2016 at 14:01
  • yes i using yml format Commented Apr 4, 2016 at 19:19

1 Answer 1

0

In doctrine config, you need to specify the mapping type. In this case, "annotation"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.