DoctrineType.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Bundle\WebConfiguratorBundle\Form;
  11. use Symfony\Bundle\WebConfiguratorBundle\Step\DoctrineStep;
  12. use Symfony\Component\Form\Type\AbstractType;
  13. use Symfony\Component\Form\FormBuilder;
  14. /**
  15. * Doctrine Form Type.
  16. *
  17. * @author Fabien Potencier <fabien@symfony.com>
  18. */
  19. class DoctrineType extends AbstractType
  20. {
  21. public function buildForm(FormBuilder $builder, array $options)
  22. {
  23. $builder
  24. ->add('driver', 'choice', array('choices' => DoctrineStep::getDrivers()))
  25. ->add('name', 'text')
  26. ->add('host', 'text')
  27. ->add('user', 'text')
  28. ->add('password', 'repeated', array(
  29. 'required' => false,
  30. 'type' => 'password',
  31. 'first_name' => 'Password',
  32. 'second_name' => 'Password again',
  33. ))
  34. ;
  35. }
  36. public function getDefaultOptions(array $options)
  37. {
  38. return array(
  39. 'data_class' => 'Symfony\Bundle\WebConfiguratorBundle\Step\DoctrineStep',
  40. );
  41. }
  42. }