我用FosUserBundle和SonataUserBundle我的Symfony2项目。
我现在感到困惑。 我想补充的字段为实体用户,但它不工作。 没有为架构,例如没有更新。
下面是我的配置:
AppKernel:
...
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle(),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle('FOSUserBundle')
config.yml:
...
# FOSUserBundle Configuration
fos_user:
db_driver: orm # BDD type
firewall_name: main # firewall name
user_class: Application\Sonata\UserBundle\Entity\User # entity class defined
并且用户实体添加字段,在应用程序/应用/索纳塔/ userBundle /实体/
namespace Application\Sonata\UserBundle\Entity;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
/**
* This file has been generated by the Sonata EasyExtends bundle ( http://sonata- project.org/easy-extends )
*
* References :
* working with object : http://www.doctrine-project.org/projects/orm/2.0 /docs/reference/working-with-objects/en
*
* @author <yourname> <youremail>
*/
class User extends BaseUser
{
/**
* @var integer $id
*/
protected $id;
/**
* @var string
*/
protected $institution;
/**
* @var string
*/
protected $department;
/**
* @var string
*/
protected $city;
/**
* @var string
*/
protected $country;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getInstitution()
{
return $this->institution;
}
/**
* @return string
*/
public function getDepartment()
{
return $this->department;
}
/**
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* @return string
*/
public function getCountry()
{
return $this->country;
}
}
在我的数据库,表fos_user_user似乎与用户保存的数据表。
打电话时不创建添加字段(国家,城市...)“的PHP应用程序/控制台学说:架构:更新--force”。 如何字段添加到用户实体? 我失去了在fosuserbundle和sonatauserbundle ....