Exemplo n.º 1
0
 /**
  * @param ContainerBuilder $container
  * @param array            $config
  */
 public function configureFormFactory(ContainerBuilder $container, array $config)
 {
     if (!$config['form']['mapping']['enabled'] || version_compare(Kernel::VERSION, '2.8', '<')) {
         $container->removeDefinition('sonata.core.form.extension.dependency');
         return;
     }
     $container->setParameter('sonata.core.form.mapping.type', $config['form']['mapping']['type']);
     $container->setParameter('sonata.core.form.mapping.extension', $config['form']['mapping']['extension']);
     FormHelper::registerFormTypeMapping($config['form']['mapping']['type']);
     foreach ($config['form']['mapping']['extension'] as $ext => $idx) {
         FormHelper::registerFormExtensionMapping($ext, $idx);
     }
     $definition = $container->getDefinition('sonata.core.form.extension.dependency');
     $definition->replaceArgument(4, FormHelper::getFormTypeMapping());
     $definition = $container->getDefinition('sonata.core.form.extension.dependency');
     $definition->replaceArgument(5, FormHelper::getFormExtensionMapping());
 }