Database Symfony三数据库关系
我的项目中有三个实体 第一实体:Database Symfony三数据库关系,database,symfony,Database,Symfony,我的项目中有三个实体 第一实体: class Entity1 { /** * @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity2", inversedBy="i") * */ protected $j; } 第二实体: class Entity2 { /** * @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity1",
class Entity1
{
/**
* @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity2", inversedBy="i")
*
*/
protected $j;
}
第二实体:
class Entity2
{
/**
* @ORM\ManyToMany(targetEntity="App\MyBundle\Entity\Entity1", mappedBy="j")
*/
protected $i;
}
现在我在实体1和实体2之间有一个多个连接,表如下所示
表名:entity1\u entity2
字段:entity1\u id、entity2\u id
我想创建第三个实体,并将其连接到具有oneToMany关系的相关表entity1\u entity2?我该怎么做?此用例是否可行?您必须将
entity1\u entity2
转换为自己的实体,并使entity1
和entity2
与此实体建立多对一关系,才能继续使用第三个实体。非常感谢您的支持,这是一个好主意。