Symfony\Bundle\FrameworkBundle\Controller\Controller::createForm PHP Method

createForm() protected method

Creates and returns a Form instance from the type of the form.
protected createForm ( string $type, mixed $data = null, array $options = [] ) : Form
$type string The fully qualified class name of the form type
$data mixed The initial data for the form
$options array Options for the form
return Symfony\Component\Form\Form
    protected function createForm($type, $data = null, array $options = array())
    {
        return $this->container->get('form.factory')->create($type, $data, $options);
    }

Usage Example

 /**
  * @param string|\Symfony\Component\Form\FormTypeInterface $type
  * @param null                                             $data
  * @param array                                            $options
  * @param string|null                                      $editionRole
  *
  * @return \Symfony\Component\Form\Form
  */
 public function createForm($type, $data = null, array $options = array(), $editionRole = null)
 {
     if (!isset($options['disabled']) && !is_null($editionRole)) {
         $options['disabled'] = !$this->get('security.authorization_checker')->isGranted($editionRole, $data);
     }
     return parent::createForm($type, $data, $options);
 }
All Usage Examples Of Symfony\Bundle\FrameworkBundle\Controller\Controller::createForm