我不知道这个应用程序使用什么关系:多个订单可以有相同的存储空间,一个存储空间可以引用多个订单。我尝试了多对多,单向和一对多,双向但使用另一个表的这种解决方案,例如付款状态。
我得到错误
The mappings AppBundle \ Entity \ ... and AppBundle \ Entity \ ... are inconsistent with each other.
我不知道这个应用程序使用什么关系:多个订单可以有相同的存储空间,一个存储空间可以引用多个订单。我尝试了多对多,单向和一对多,双向但使用另一个表的这种解决方案,例如付款状态。
我得到错误
The mappings AppBundle \ Entity \ ... and AppBundle \ Entity \ ... are inconsistent with each other.
AFAIU 您试图描述一对多的关系:Order (*)-----(1) StorageSpace
如果是这样,这是您正在寻找的文档:http: //docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many -双向
这将导致类似于以下映射:
/** @ORM\Entity */
class Order
{
//...
/** @ORM\ManyToOne(targetEntity="StorageSpace", inversedBy="orders") */
private $storageSpace;
}
/** @ORM\Entity */
class StorageSpace
{
//...
/** @ORM\OneToMany(targetEntity="Order", mappedBy="storageSpace") */
private $orders;
public function __construct()
{
$this->orders = new ArrayCollection;
}
}