所以,我有以下实体结构:
/**
* @ORM\Entity
*/
class Group
{
/**
* Many-To-Many, Unidirectional
*
* @var ArrayCollection $permissions
*
* @ORM\ManyToMany(targetEntity="Permission")
* @ORM\JoinTable(name="group_has_permission",
* joinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="permission_id", referencedColumnName="id")}
* )
*/
protected $permissions;
public function __construct()
{
$this->permissions = new ArrayCollection();
}
}
/**
* @ORM\Entity
*/
class Permission {}
这只是一个例子,但我很困惑。我需要另一个可能称为“group_has_permission”的实体,它有两个字段:group_id 和 permission_id,对吗?还是我错了?