2017 © Pedro Peláez
 

lib symfony-form-options-builder

buildForm() with objects instead of array

image

steevanb/symfony-form-options-builder

buildForm() with objects instead of array

  • Thursday, January 18, 2018
  • by kujaff
  • Repository
  • 2 Watchers
  • 1 Stars
  • 341 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 34 Versions
  • 2 % Grown

The README.md

version php symfony Lines Total Downloads Scrutinizer, (*1)

symfony-form-options-builder

It helps you writing your Symfony FormType, with some traits and methods to add fields in buildForm() instead of array with some mysterious keys, and other stuff., (*2)

Installation, (*3)

Changelog, (*4)

Object-oriented FormType

FormType::buildForm() object oriented instead of array, (*5)

Example:, (*6)

namespace FooBundle\Form\Type;

use Steevanb\SymfonyFormOptionsBuilder\OptionsBuilder\EmailOptionsBuilder;
use Steevanb\SymfonyFormOptionsBuilder\OptionsBuilder\TextOptionsBuilder;
use Symfony\Component\Form\Extension\Core\Type\TextType;

class BarType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        # Since PHP 5.5, you can use FooClass::class
        $builder->add('field_text', TextType::class, TextOptionsBuilder::create()->asArray());

        # Since PHP 5.6, you can use the variadic syntax. asVariadic() parameter is field name.
        $builder->add(
            ...EmailOptionsBuilder::create()
                ->setRequired(false)
                ->setPlaceHolder('default@mail.com')
                ->setTrim(false)
                ->asVariadic('field_email')
        );
    }
}

More documentation, (*7)

BlockPrefixTrait

Add getBlockPrefix(), to always return same syntax for form type getBlockPrefix() method: form_type_formtypeclassname, (*8)

Example:, (*9)

namespace FooBundle\Form\Type;

use Steevanb\SymfonyFormOptionsBuilder\BlockPrefixTrait;

class BarType extends AbstractType
{
    # Use this trait to define getBlockPrefix() required method. It will return form_type_bar
    use BlockPrefixTrait;
}

The Versions

18/01 2018

dev-master

9999999-dev

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

18/01 2018

4.0.0

4.0.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

10/03 2017

dev-php7

dev-php7

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

15/02 2017

3.3.2

3.3.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

17/11 2016

3.3.1

3.3.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

11/11 2016

3.3.0

3.3.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

31/08 2016

3.2.2

3.2.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

18/08 2016

3.2.1

3.2.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

04/08 2016

3.2.0

3.2.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

09/06 2016

3.1.0

3.1.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/06 2016

3.0.0

3.0.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/06 2016

dev-symfony-2

dev-symfony-2

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/06 2016

2.1.5

2.1.5.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

30/05 2016

2.1.4

2.1.4.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

31/12 2015

2.1.3

2.1.3.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

09/12 2015

2.1.2

2.1.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

08/12 2015

2.1.1

2.1.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

03/12 2015

2.1.0

2.1.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

02/12 2015

2.0.2

2.0.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

02/12 2015

2.0.1

2.0.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/12 2015

2.0.0

2.0.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

28/10 2015

1.4.2

1.4.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

09/10 2015

1.4.1

1.4.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/10 2015

1.4.0

1.4.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

01/10 2015

1.3.4

1.3.4.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

30/09 2015

1.3.3

1.3.3.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

28/09 2015

1.3.2

1.3.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

18/09 2015

1.3.1

1.3.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

18/09 2015

1.3.0

1.3.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

16/09 2015

1.2.0

1.2.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

21/08 2015

1.1.2

1.1.2.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

11/08 2015

1.1.1

1.1.1.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

03/08 2015

1.1.0

1.1.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires

 

13/07 2015

1.0.0

1.0.0.0

buildForm() with objects instead of array

  Sources   Download

MIT

The Requires