<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\Doctrine\Form;

use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractExtension;

class DoctrineOrmExtension extends AbstractExtension
{
    protected $registry;

    /**
     * @param ManagerRegistry|LegacyManagerRegistry $registry
     */
    public function __construct($registry)
    {
        $this->registry = $registry;
    }

    protected function loadTypes()
    {
        return [
            new EntityType($this->registry),
        ];
    }

    protected function loadTypeGuesser()
    {
        return new DoctrineOrmTypeGuesser($this->registry);
    }
}
