我正在使用Symfony2,当我尝试追加FOSUserBundle时,但是我收到了一个错误 (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(),
];
// --------------------------------------------- -------应用/配置/ 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-主> kipeoBundle&GT ;实体> 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
}
}
// --------------------------------------------- -------应用/配置/ routing.yml中
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
答案 0 :(得分:0)
在原则配置中,您需要指定映射类型。在这种情况下,“注释”