Skip to content

Repository files navigation

EntityHiddenTypeBundle

Latest Stable VersionTotal DownloadsLicense

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
{
publicfunctionregisterBundles()
{
$bundles = array(
// ...newQbbr\EntityHiddenTypeBundle\EntityHiddenTypeBundle(),
);
// ...
}
// ...
}

Usage

<?php// src/AppBundle/Form/Type/MyType.phpnamespaceAppBundle\Form\Type;
useSymfony\Component\Form\AbstractType;
useSymfony\Component\Form\FormBuilderInterface;
// for Symfony < 2.8 rm use typeuseQbbr\EntityHiddenTypeBundle\Form\Type\EntityHiddenType;
class MyType extends AbstractType
{
publicfunctionbuildForm(FormBuilderInterface$builder, array$options)
{
$builder// for < 2.8 use 'entity_hidden'
->add('parent', EntityHiddenType::class, [
'class' => 'AppBundle\Entity\MyEntity',
]);
}
// for < 2.8 use getName()publicfunctiongetBlockPrefix()
{
return'my';
}
}

About

Symfony 2 entity hidden form type

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages