Additional components for the Symfony2 form components

Installs: 170 096

Dependents: 1

Suggesters: 0

Security: 0

Stars: 22

Watchers: 6

Forks: 9

Open Issues: 2

Type:symfony2-component

2.0.0 2016-03-31 19:42 UTC

This package is not auto-updated.

Last update: 2024-11-09 14:37:29 UTC


README

##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