vendor/friendsofsymfony/user-bundle/Form/Factory/FormFactory.php line 61

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSUserBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.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 FOS\UserBundle\Form\Factory;
  11. use Symfony\Component\Form\FormFactoryInterface;
  12. class FormFactory implements FactoryInterface
  13. {
  14.     /**
  15.      * @var FormFactoryInterface
  16.      */
  17.     private $formFactory;
  18.     /**
  19.      * @var string
  20.      */
  21.     private $name;
  22.     /**
  23.      * @var string
  24.      */
  25.     private $type;
  26.     /**
  27.      * @var array
  28.      */
  29.     private $validationGroups;
  30.     /**
  31.      * FormFactory constructor.
  32.      *
  33.      * @param FormFactoryInterface $formFactory
  34.      * @param string               $name
  35.      * @param string               $type
  36.      * @param array                $validationGroups
  37.      */
  38.     public function __construct(FormFactoryInterface $formFactory$name$type, array $validationGroups null)
  39.     {
  40.         $this->formFactory $formFactory;
  41.         $this->name $name;
  42.         $this->type $type;
  43.         $this->validationGroups $validationGroups;
  44.     }
  45.     /**
  46.      * {@inheritdoc}
  47.      */
  48.     public function createForm(array $options = array())
  49.     {
  50.         $options array_merge(array('validation_groups' => $this->validationGroups), $options);
  51.         return $this->formFactory->createNamed($this->name$this->typenull$options);
  52.     }
  53. }