Php 条令方案更新。俯瞰实体
我已经创建了2个新实体,当我运行Php 条令方案更新。俯瞰实体,php,symfony,doctrine-orm,doctrine,Php,Symfony,Doctrine Orm,Doctrine,我已经创建了2个新实体,当我运行 app/console doctrine:schema:update --force 它说我是最新的,这两个新实体没有创建表 我找到的每个其他命令都将检测其他捆绑包中的实体,但我正在处理的捆绑包中没有实体。例如 app/console doctrine:mapping:info 它也没有显示在那里 这里有一个例子。它位于我的包的实体文件夹中 <?php namespace test\OrganizationBundle\Entity; use Sy
app/console doctrine:schema:update --force
它说我是最新的,这两个新实体没有创建表
我找到的每个其他命令都将检测其他捆绑包中的实体,但我正在处理的捆绑包中没有实体。例如
app/console doctrine:mapping:info
它也没有显示在那里
这里有一个例子。它位于我的包的实体文件夹中
<?php
namespace test\OrganizationBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
/**
* Department
* @ORM\Entity
* @ORM\Table(name="departments")
*/
class Department
{
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=50, nullable=false)
*/
private $name;
/**
* @var integer
* @ORM\Column(name="facilityId", type="int")
*
*/
private $facilityId;
/**
* @var \DateTime
* @ORM\Column(name="created", type="datetime")
*/
private $created;
/**
* @var \DateTime
* @ORM\Column(name="updated", type="datetime")
*/
private $updated;
/**
* @var array
* @ORM\ManyToMany(targetEntity="DeptTag", mappedBy="departments")
*/
private $deptTags;
public function __construct()
{
$this->deptTags = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Department
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set facilityId
*
* @param string $facilityId
*
* @return Department
*/
public function setFacilityId($facilityId)
{
$this->facilityId = $facilityId;
return $this;
}
/**
* Get facilityId
*
* @return string
*/
public function getFacilityId()
{
return $this->facilityId;
}
/**
* Set created
*
* @param \DateTime $created
*
* @return Department
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param \DateTime $updated
*
* @return Department
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set deptTags
*
* @param array $deptTags
*
* @return Department
*/
public function setDeptTags($deptTags)
{
$this->deptTags = $deptTags;
return $this;
}
/**
* Get deptTags
*
* @return array
*/
public function getDeptTags(DeptTag)
{
return $this->deptTags[] = $deptTag;
}
}
您是否将条令的自动映射设置为true?还要尝试运行应用程序/控制台条令:schema:update--force-edev
。我添加了-edev
,以在创建带有注释的类时强制重新生成缓存added@AlexandruFurculita谢谢你给我指引了正确的方向。该包的配置文件中有一个名为“条令”的文件夹,它生成了我删除的文件。现在,实体被检测到了