public function addRelationship($key, $relation, array $links=[], array $meta=[], array $options=[]) {
		$this->ensureResourceObject();
		
		$options = array_merge(self::$defaults, $options);
		
		$relationshipObject = $this->resource->addRelationship($key, $relation, $links, $meta);
		
		if ($options['includeContainedResources']) {
			$this->addIncludedResourceObject(...$relationshipObject->getNestedContainedResourceObjects());
		}
	}
public function addRelationship($key, $relation, array $links=[], array $meta=[], array $options=[]) {
		$this->ensureResourceObject();
		
		$options = array_merge(self::$defaults, $options);
		
		$relationshipObject = $this->resource->addRelationship($key, $relation, $links, $meta);
		
		if ($options['includeContainedResources']) {
			$this->addIncludedResourceObject(...$relationshipObject->getNestedContainedResourceObjects());
		}
	}
public function addRelationship ( $ key , $ relation , array $ links = [ ] , array $ meta = [ ] , array $ options = [ ] ) { $ this -> ensureResourceObject ( ) ; $ options = array_merge ( self :: $ defaults , $ options ) ; $ relationshipObject = $ this -> resource -> addRelationship ( $ key , $ relation , $ links , $ meta ) ; if ( $ options [ 'includeContainedResources' ] ) { $ this -> addIncludedResourceObject ( ... $ relationshipObject -> getNestedContainedResourceObjects ( ) ) ; } }
add a relation to the resource

adds included resources if found inside the relation, unless $options['includeContainedResources'] is set to false

@param string  $key
@param mixed   $relation ResourceInterface | ResourceInterface[] | CollectionDocument
@param array   $links    optional
@param array   $meta     optional
@param array   $options  optional {@see ResourceDocument::$defaults}
add a relation to the resource