0
當我嘗試運行php app/config doctrine:schema:update --force
或只是symply在Web瀏覽器中打開我的項目,我得到這個錯誤:沒有標識符指定的錯誤Symfony2的學說ORM映射
MappingException: No identifier/primary key specified for Entity "Registration\BusinessBundle\Entity\BusinessUser". Every Entity must have an identifier/primary key.
手動刪除應用程序/緩存文件夾,但問題依然。如果我試圖通過命令php app/console cache:clear
刪除緩存,我會得到相同的錯誤。
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
{
/*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/*
* @ORM\Column(type="string", length=255)
*/
protected $surname;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set surname
*
* @param string $surname
* @return BusinessUser
*/
public function setSurname($surname)
{
$this->surname = $surname;
return $this;
}
/**
* Get surname
*
* @return string
*/
public function getSurname()
{
return $this->surname;
}
}
嘗試將id列的策略從AUTO更改爲IDENTITY。 – JimL 2014-10-18 14:31:17
這沒有做任何改變。 – Einius 2014-10-18 14:43:56