A Symfony2 Bundle provide some extra form type.
- Add EasyFormBundle in your composer.json
- Enable the Bundle
- Use the registered types
Add EasyFormBundle in your composer.json:
{
"require": {
"xiidea/easy-form-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update xiidea/easy-form-bundle
Composer will install the bundle to your project's vendor/xiidea
directory.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Xiidea\EasyFormBundle\XiideaEasyFormBundle(),
);
}
Now you can use the registered types in ordinary way. currently available types are:
- hidden_entity
you can add a "hidden_entity" field to the form as follow:
$builder
->add('fieldName', 'hidden_entity', array(
'class' => 'Acme\DemoBundle\Entity\YourEntity'
));