src/Serializer/JsonApiSerializer.php
public function includedData(ResourceInterface $resource, array $data)
    {
        list($serializedData, $linkedIds) = $this->pullOutNestedIncludedData($data);

        foreach ($data as $value) {
            foreach ($value as $includeObject) {
                if ($this->isNull($includeObject) || $this->isEmpty($includeObject)) {
                    continue;
                }

                $includeObjects = $this->createIncludeObjects($includeObject);
                list($serializedData, $linkedIds) = $this->serializeIncludedObjectsWithCacheKey($includeObjects, $linkedIds, $serializedData);
            }
        }

        return empty($serializedData) ? [] : ['included' => $serializedData];
    }
public function includedData(ResourceInterface $resource, array $data)
    {
        list($serializedData, $linkedIds) = $this->pullOutNestedIncludedData($data);

        foreach ($data as $value) {
            foreach ($value as $includeObject) {
                if ($this->isNull($includeObject) || $this->isEmpty($includeObject)) {
                    continue;
                }

                $includeObjects = $this->createIncludeObjects($includeObject);
                list($serializedData, $linkedIds) = $this->serializeIncludedObjectsWithCacheKey($includeObjects, $linkedIds, $serializedData);
            }
        }

        return empty($serializedData) ? [] : ['included' => $serializedData];
    }
public function includedData ( ResourceInterface $ resource , array $ data ) { list ( $ serializedData , $ linkedIds ) = $ this -> pullOutNestedIncludedData ( $ data ) ; foreach ( $ data as $ value ) { foreach ( $ value as $ includeObject ) { if ( $ this -> isNull ( $ includeObject ) || $ this -> isEmpty ( $ includeObject ) ) { continue ; } $ includeObjects = $ this -> createIncludeObjects ( $ includeObject ) ; list ( $ serializedData , $ linkedIds ) = $ this -> serializeIncludedObjectsWithCacheKey ( $ includeObjects , $ linkedIds , $ serializedData ) ; } } return empty ( $ serializedData ) ? [ ] : [ 'included' => $ serializedData ] ; }
Serialize the included data.

@param ResourceInterface $resource
@param array $data

@return array
Serialize the included data .