/** * Compute the union of this collection and the given collection. * * @param CollectionInterface $collection The collection to intersect. * * @return CollectionInterface */ public function union($collection) { $union = clone $this; /** @var ModelInterface $otherModel */ foreach ($collection->diff($this) as $otherModel) { $union->push($otherModel); } return $union; }