我正在使用Symfony2,当我尝试附加FOSUserBundle时,我遇到了一个错误(bin/console条令:模式:更新-强制)
//---------------------------------------------------------------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>实体>用户.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"
在条令配置中,您需要指定映射类型。在这种情况下,"annotation"