Symfony2 Form Component additions
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DataTransformer don't throw exception in reverseTransform when id is empty but return… Sep 3, 2013
Type Updating HiddenEntityType to be Symfony 3.0 complient, without breaki… Feb 19, 2016
README.md
composer.json Release: Update readme and composer with 2.0.0 version for Symfony3 c… Mar 31, 2016

README.md

##Additional Form Components

This collection of classes add functionality to the Symfony2 Form component.

###Installation

To install the form component simply add it to your composer.json requirements:

"require": {
        "lrotherfield/form": "2.0.x-dev",
}

And then run composer.phar update

###Hidden entity type

To use the hidden entity type you need to register it as a service in your config.yml or a services.yml file:

services:
    lrotherfield.form.type.hidden_entity:
        class: Lrotherfield\Component\Form\Type\HiddenEntityType
        arguments:
            - @doctrine.orm.entity_manager
        tags:
            - { name: form.type, alias: hidden_entity }

You can use then use the type with the form builder:

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        //...
        ->add('example', 'hidden_entity', array(
                "class" => "Lrotherfield\\Bundle\\ExampleBundle\\Entity\\ExampleEntity"
            ));
    ;
}

The only additional requirement is the "class" option which must be a fully qualified namespace to the entity that you want to be used in the transformation