/** * Construct new instance of ResourceAssociationSetEnd * Note: The $resourceSet represents collection of an entity, The * $resourceType can be this entity's type or type of any of the * base resource of this entity, on which the navigation property * represented by $resourceProperty is defined. * * @param ResourceSet $resourceSet Resource set for the association end * @param ResourceType $resourceType Resource type for the association end * @param ResourceProperty $resourceProperty Resource property for the association end * * @throws \InvalidArgumentException */ public function __construct(ResourceSet $resourceSet, ResourceType $resourceType, $resourceProperty) { if (!is_null($resourceProperty) && !$resourceProperty instanceof ResourceProperty) { throw new \InvalidArgumentException(Messages::resourceAssociationSetPropertyMustBeNullOrInstanceofResourceProperty('$resourceProperty')); } if (!is_null($resourceProperty) && (is_null($resourceType->resolveProperty($resourceProperty->getName())) || $resourceProperty->getKind() != ResourcePropertyKind::RESOURCE_REFERENCE && $resourceProperty->getKind() != ResourcePropertyKind::RESOURCESET_REFERENCE)) { throw new \InvalidArgumentException(Messages::resourceAssociationSetEndPropertyMustBeNavigationProperty($resourceProperty->getName(), $resourceType->getFullName())); } if (!$resourceSet->getResourceType()->isAssignableFrom($resourceType) && !$resourceType->isAssignableFrom($resourceSet->getResourceType())) { throw new \InvalidArgumentException(Messages::resourceAssociationSetEndResourceTypeMustBeAssignableToResourceSet($resourceType->getFullName(), $resourceSet->getName())); } $this->_resourceSet = $resourceSet; $this->_resourceType = $resourceType; $this->_resourceProperty = $resourceProperty; }