首先删除 Application/Sonata/UserBundle/Resources/config/doctrine
稍后将 Entity/User.php 和 Entity/Group.php 更改为注释类型:
<?php
namespace Application\Sonata\UserBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
/**
* User
*
* @ORM\Table(name="fos_user_user")
* @ORM\Entity
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=127)
*/
protected $test;
}
<?php
namespace Application\Sonata\UserBundle\Entity;
use Sonata\UserBundle\Entity\BaseGroup as BaseGroup;
use Doctrine\ORM\Mapping as ORM;
/**
* Group
*
* @ORM\Table(name="fos_user_group")
* @ORM\Entity
*/
class Group extends BaseGroup
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
最后你应该输入: php app/console dictionary:schema:update --force 一切都应该很好。