public function setPrimaryResource(ResourceInterface $resource, array $options=[]) {
		if ($resource instanceof ResourceDocument) {
			throw new InputException('does not make sense to set a document inside a document, use ResourceObject or ResourceIdentifierObject instead');
		}
		
		$options = array_merge(self::$defaults, $options);
		
		$this->resource = $resource;
		
		if ($options['includeContainedResources'] && $this->resource instanceof RecursiveResourceContainerInterface) {
			$this->addIncludedResourceObject(...$this->resource->getNestedContainedResourceObjects());
		}
	}
public function setPrimaryResource(ResourceInterface $resource, array $options=[]) {
		if ($resource instanceof ResourceDocument) {
			throw new InputException('does not make sense to set a document inside a document, use ResourceObject or ResourceIdentifierObject instead');
		}
		
		$options = array_merge(self::$defaults, $options);
		
		$this->resource = $resource;
		
		if ($options['includeContainedResources'] && $this->resource instanceof RecursiveResourceContainerInterface) {
			$this->addIncludedResourceObject(...$this->resource->getNestedContainedResourceObjects());
		}
	}
public function setPrimaryResource ( ResourceInterface $ resource , array $ options = [ ] ) { if ( $ resource instanceof ResourceDocument ) { throw new InputException ( 'does not make sense to set a document inside a document, use ResourceObject or ResourceIdentifierObject instead' ) ; } $ options = array_merge ( self :: $ defaults , $ options ) ; $ this -> resource = $ resource ; if ( $ options [ 'includeContainedResources' ] && $ this -> resource instanceof RecursiveResourceContainerInterface ) { $ this -> addIncludedResourceObject ( ... $ this -> resource -> getNestedContainedResourceObjects ( ) ) ; } }
overwrites the primary resource

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

@param ResourceInterface $resource
@param array             $options  optional {@see ResourceDocument::$defaults}

@throws InputException if the $resource is a ResourceDocument itself
overwrites the primary resource