当我尝试更新我的架构时,我收到了此消息
[@localhost you]$ php app/console doctrine:schema:update --force
[Doctrine\DBAL\Schema\SchemaException]
There is no column with name 'family_id' on table 'unit__family__convert'.
这是我的UnitFamilyConvert类的开头
/**
* UnitFamilyConvert
*
* @ORM\Table(name="unit__family__convert")
* @ORM\Entity()
* @ExclusionPolicy("all")
*/
class UnitFamilyConvert
{
/**
* @var integer
*
* @ORM\Column(name="family_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Expose
* @Groups({"All"})
*/
private $family_id;
我已经尝试用
清理ORM的缓存了app/console doctrine:cache:clear-metadata
app/console doctrine:cache:clear-query
app/console doctrine:cache:clear-result app/console cache:clear
为什么Doctrine找不到我的专栏?
答案 0 :(得分:0)
https://stackoverflow.com/a/18164075/4758940
这篇文章帮助了我。
Id
标识符是必需的,因此这是我的新类:
/**
* UnitFamilyConvert
*
* @ORM\Table(name="unit__family__convert")
* @ORM\Entity()
* @ExclusionPolicy("all")
*/
class UnitFamilyConvert
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Expose
* @Groups({"All"})
*/
private $id;
/**
* @var integer
* @ORM\Column(name="family_id", type="integer")
*/
private $family_id;