Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface::getRelationshipsPrimaryMeta PHP Method

getRelationshipsPrimaryMeta() public method

Get meta-information about resource relationships when resource is primary.
    public function getRelationshipsPrimaryMeta();

Usage Example

コード例 #1
0
ファイル: Document.php プロジェクト: brzuchal/json-api
 /**
  * @inheritdoc
  */
 public function setResourceCompleted(ResourceObjectInterface $resource)
 {
     $idx = $resource->getId();
     $type = $resource->getType();
     $foundInData = isset($this->bufferForData[$type][$idx]);
     $foundInIncluded = isset($this->bufferForIncluded[$type][$idx]);
     if ($foundInData === true) {
         $representation = $this->bufferForData[$type][$idx];
         unset($this->bufferForData[$type][$idx]);
         if (empty($representation[self::KEYWORD_RELATIONSHIPS]) === true) {
             // if no relationships have been added remove empty placeholder
             unset($representation[self::KEYWORD_RELATIONSHIPS]);
         } else {
             // relationship might have meta
             $relShipsMeta = $resource->getRelationshipsPrimaryMeta();
             if (empty($relShipsMeta) === false) {
                 $representation[self::KEYWORD_RELATIONSHIPS][self::KEYWORD_META] = $relShipsMeta;
             }
         }
         $this->data[] = $representation;
     }
     if ($foundInIncluded === true) {
         $representation = $this->bufferForIncluded[$type][$idx];
         unset($this->bufferForIncluded[$type][$idx]);
         if (empty($representation[self::KEYWORD_RELATIONSHIPS]) === true) {
             // if no relationships have been added remove empty placeholder
             unset($representation[self::KEYWORD_RELATIONSHIPS]);
         } else {
             // relationship might have meta
             $relShipsMeta = $resource->getRelationshipsInclusionMeta();
             if (empty($relShipsMeta) === false) {
                 $representation[self::KEYWORD_RELATIONSHIPS][self::KEYWORD_META] = $relShipsMeta;
             }
         }
         $this->included[] = $representation;
         // remember we added (type, id) at index
         $this->includedResources[$type][$idx] = $this->includedIndex;
         $this->includedIndex++;
     }
 }
All Usage Examples Of Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface::getRelationshipsPrimaryMeta