/** * Construct new instance of ResourceAssociationTypeEnd * * @param string $name name of the end * @param ResourceType $resourceType resource type that the end * refers to * @param ResourceProperty|null $resourceProperty property of the end, can be * NULL if relationship is * uni-directional * @param ResourceProperty|null $fromProperty Property on the related end * that points to this end, can * be NULL if relationship is * uni-directional */ public function __construct($name, ResourceType $resourceType, $resourceProperty, $fromProperty) { if (is_null($resourceProperty) && is_null($fromProperty)) { throw new \InvalidArgumentException(Messages::resourceAssociationTypeEndBothPropertyCannotBeNull()); } if (!is_null($fromProperty) && !$fromProperty instanceof ResourceProperty) { throw new \InvalidArgumentException(Messages::resourceAssociationTypeEndPropertyMustBeNullOrInstanceofResourceProperty('$fromProperty')); } if (!is_null($resourceProperty) && !$resourceProperty instanceof ResourceProperty) { throw new \InvalidArgumentException(Messages::resourceAssociationTypeEndPropertyMustBeNullOrInstanceofResourceProperty('$$resourceProperty')); } $this->_name = $name; $this->_resourceType = $resourceType; $this->_resourceProperty = $resourceProperty; $this->_fromProperty = $fromProperty; }