2
我想了解如何使用Symfony2和FOSUserBundle進行註冊。我是這樣做與提供的文檔,一步一步:https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md但是當我嘗試運行comman php app/console doctrine:schema:update --force
我得到這個錯誤:如果我運行命令php app/console cache:clear
Symfony2 FOSUserBundle無法更新原則數據庫架構或清除緩存
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity "Registration\BusinessBundle\Entity\BusinessUser"
sub class of "FOS\UserBundle\Model\User".
Every Entity must have an identifier/primary key.
我得到同樣的錯誤。我嘗試手動刪除緩存文件夾,但當我嘗試更新教義架構時,再次出現相同的錯誤。
我BusinessUser實體:
<?php
namespace Registration\BusinessBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="business_user")
*/
class BusinessUser extends BaseUser
{
/*
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
}
}