我使用注释在数据库中创建表,我认为是orm。yml希望这个解决方案是可行的。。。
//inverse side
class Product
{
/**
* @ORM\OneToMany(targetEntity="ProductOperation", mappedBy="product", cascade={"persist", "remove"})
*/
private $productOperations;
}
//owing side
class ProductOperation
{
/**
* @ORM\ManyToOne(targetEntity="Product", inversedBy="productOperations")
*/
private $product;
/**
* @ORM\ManyToOne(targetEntity="Operation", inversedBy="productOperations")
*/
private $operation;
}
//inverse side
class Operation
{
/**
* @ORM\OneToMany(targetEntity="ProductOperation", mappedBy="operation", cascade={"persist", "remove"})
*/
private $productOperations;
}