DoctrineOrmExtension.php 844 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bridge\Doctrine\Form;
  11. use Doctrine\Persistence\ManagerRegistry;
  12. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  13. use Symfony\Component\Form\AbstractExtension;
  14. class DoctrineOrmExtension extends AbstractExtension
  15. {
  16. protected $registry;
  17. public function __construct(ManagerRegistry $registry)
  18. {
  19. $this->registry = $registry;
  20. }
  21. protected function loadTypes()
  22. {
  23. return [
  24. new EntityType($this->registry),
  25. ];
  26. }
  27. protected function loadTypeGuesser()
  28. {
  29. return new DoctrineOrmTypeGuesser($this->registry);
  30. }
  31. }