DoctrineOrmExtension.php 855 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 Symfony\Component\Form\AbstractExtension;
  12. use Doctrine\ORM\EntityManager;
  13. class DoctrineOrmExtension extends AbstractExtension
  14. {
  15. /**
  16. * The Doctrine 2 entity manager
  17. * @var Doctrine\ORM\EntityManager
  18. */
  19. protected $em = null;
  20. public function __construct(EntityManager $em)
  21. {
  22. $this->em = $em;
  23. }
  24. protected function loadTypes()
  25. {
  26. return array(
  27. new Type\EntityType($this->em),
  28. );
  29. }
  30. protected function loadTypeGuesser()
  31. {
  32. return new DoctrineOrmTypeGuesser($this->em);
  33. }
  34. }