for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AppBundle\Controller;
use Symfony\Component\Form\Extension\Core\Type\FormType;
trait ServicesTrait
{
/**
* @param string $name
* @param mixed $data
* @param array $options
*
* @return \Symfony\Component\Form\FormBuilderInterface
*/
public function createNamedBuilder($name, $data = null, array $options = [])
/** @var \Symfony\Component\Form\FormFactoryInterface $factory */
$factory = $this->container->get('form.factory');
container
AppBundle\Controller\ServicesTrait
$defaults = ['action' => '#'];
return $factory->createNamedBuilder($name, FormType::class, $data, array_merge($defaults, $options));
}