Doctrine\Search\UnitOfWork::hydrateCollection PHP Method

hydrateCollection() public method

Construct an entity collection
public hydrateCollection ( array $classes, Traversable $resultSet )
$classes array
$resultSet Traversable
    public function hydrateCollection(array $classes, Traversable $resultSet)
    {
        $collection = new ArrayCollection();
        foreach ($resultSet as $document) {
            foreach ($classes as $class) {
                if ($document->getIndex() == $class->index && $document->getType() == $class->type) {
                    break;
                }
            }
            $collection[] = $this->hydrateEntity($class, $document);
        }
        return $collection;
    }