/** * Construct new instance of ResourceAssociationSet * * @param string $name Name of the association set * @param ResourceAssociationSetEnd $end1 First end set participating * in the association set * @param ResourceAssociationSetEnd $end2 Second end set participating * in the association set * * @throws \InvalidArgumentException */ public function __construct($name, ResourceAssociationSetEnd $end1, ResourceAssociationSetEnd $end2) { if (is_null($end1->getResourceProperty()) && is_null($end2->getResourceProperty())) { throw new \InvalidArgumentException(Messages::resourceAssociationSetResourcePropertyCannotBeBothNull()); } if ($end1->getResourceType() == $end2->getResourceType() && $end1->getResourceProperty() == $end2->getResourceProperty()) { throw new \InvalidArgumentException(Messages::resourceAssociationSetSelfReferencingAssociationCannotBeBiDirectional()); } $this->_name = $name; $this->_end1 = $end1; $this->_end2 = $end2; }