src/CSDT/CollectionsBundle/CollectionHelper/HelperTrait/HelperSubTrait.php
public function subMap(
        CollectionInterface $collection,
        array $keys
    ) {
        $content = $collection->toArray();
        
        $resultContent = array_intersect_key($content, array_flip($keys));

        return $this->arrayToCollection($resultContent, get_class($collection));
    }
public function subMap(
        CollectionInterface $collection,
        array $keys
    ) {
        $content = $collection->toArray();
        
        $resultContent = array_intersect_key($content, array_flip($keys));

        return $this->arrayToCollection($resultContent, get_class($collection));
    }
Sub map

Return a Collection that contain a part
of the $collection corresponding to the
to the given $keys. Note you are able to
use it with any collection.

@param CollectionInterface $collection The collection where
find the content
@param array               $keys       The keys to return

@throws \ParseError if the caster manager is not able to parse the
array to the first collection
@return CollectionInterface