qbbr / entity-hidden-type-bundle
Symfony 2 entity hidden form type
Installs: 8 467
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4.0
- symfony/framework-bundle: >=2.3
README
Installation
Step 1: Download the Bundle
Symfony >= 2.8
$ composer require qbbr/entity-hidden-type-bundle
Symfony < 2.8
$ composer require qbbr/entity-hidden-type-bundle 1.*
Step 2: Enable the Bundle
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Qbbr\EntityHiddenTypeBundle\EntityHiddenTypeBundle(), ); // ... } // ... }
Usage
<?php // src/AppBundle/Form/Type/MyType.php namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; // for Symfony < 2.8 rm use type use Qbbr\EntityHiddenTypeBundle\Form\Type\EntityHiddenType; class MyType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder // for < 2.8 use 'entity_hidden' ->add('parent', EntityHiddenType::class, [ 'class' => 'AppBundle\Entity\MyEntity', ]); } // for < 2.8 use getName() public function getBlockPrefix() { return 'my'; } }