src/CSDT/CollectionsBundle/CollectionHelper/HelperTrait/HelperMergeTrait.php
public function mergeArray(
        CollectionInterface $collection,
        array $array
    ) {
        $collectionContent = $collection->toArray();
        
        $content = array_merge($collectionContent, $array);
        
        return $this->arrayToCollection($content, get_class($collection));
    }
public function mergeArray(
        CollectionInterface $collection,
        array $array
    ) {
        $collectionContent = $collection->toArray();
        
        $content = array_merge($collectionContent, $array);
        
        return $this->arrayToCollection($content, get_class($collection));
    }
Merge array

Return a collectino of the same type as
$collection with the content of the
array. Note a data lost is possible by
example if you merge a ValueCollection
as $collection and an associative array
as $array.

@param CollectionInterface $collection The collection
@param array               $array      The array to merge

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