假设我有两个实体Bus
并且它们之间People
存在关系OneToMany
。巴士最多可容纳 10 人。
如何创建一个约束来控制它?
例如:
* @MyAssert\ParentMaxChild(max=10)
* @ORM\ManyToOne(targetEntity="Webface\CharacterBundle\Entity\Bus", inversedBy="wac")
* @ORM\JoinColumn(name="bus_id", referencedColumnName="id", nullable=false)
private $bus;