Neomerx\JsonApi\Contracts\Document\DocumentInterface::addToIncluded PHP Method

addToIncluded() public method

Add resource to 'included' section.
public addToIncluded ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : void
$resource Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
return void
    public function addToIncluded(ResourceObjectInterface $resource);

Usage Example

Example #1
0
 /**
  * @param ParserReplyInterface $reply
  * @param Frame                $current
  *
  * @return void
  */
 private function addToIncluded(ParserReplyInterface $reply, Frame $current)
 {
     if ($reply->getReplyType() === ParserReplyInterface::REPLY_TYPE_RESOURCE_STARTED) {
         $resourceObject = $current->getResource();
         $this->document->addToIncluded($resourceObject);
     }
 }