src/Serializer/JsonApiSerializer.php
public function filterIncludes($includedData, $data)
    {
        if (!isset($includedData['included'])) {
            return $includedData;
        }

        // Create the RootObjects
        $this->createRootObjects($data);

        // Filter out the root objects
        $filteredIncludes = array_filter($includedData['included'], [$this, 'filterRootObject']);

        // Reset array indizes
        $includedData['included'] = array_merge([], $filteredIncludes);

        return $includedData;
    }
public function filterIncludes($includedData, $data)
    {
        if (!isset($includedData['included'])) {
            return $includedData;
        }

        // Create the RootObjects
        $this->createRootObjects($data);

        // Filter out the root objects
        $filteredIncludes = array_filter($includedData['included'], [$this, 'filterRootObject']);

        // Reset array indizes
        $includedData['included'] = array_merge([], $filteredIncludes);

        return $includedData;
    }
public function filterIncludes ( $ includedData , $ data ) { if ( ! isset ( $ includedData [ 'included' ] ) ) { return $ includedData ; } // Create the RootObjects $ this -> createRootObjects ( $ data ) ; // Filter out the root objects $ filteredIncludes = array_filter ( $ includedData [ 'included' ] , [ $ this , 'filterRootObject' ] ) ; // Reset array indizes $ includedData [ 'included' ] = array_merge ( [ ] , $ filteredIncludes ) ; return $ includedData ; }
Hook to manipulate the final sideloaded includes.
The JSON API specification does not allow the root object to be included
into the sideloaded `included`-array. We have to make sure it is
filtered out, in case some object links to the root object in a
relationship.

@param array $includedData
@param array $data

@return array
Hook to manipulate the final sideloaded includes . The JSON API specification does not allow the root object to be included into the sideloaded included - array . We have to make sure it is filtered out in case some object links to the root object in a relationship .