Skip to content

Instantly share code, notes, and snippets.

View webmozart's full-sized avatar

Bernhard Schussek webmozart

View GitHub Profile
<?php
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ApplicationFormType extends AbstractType
Using a static OptionSupport class that automatically writes options into properties AND fields extend it.
+ Options are set in the very beginning of the constructor
+ Concise
+ Error if option is not supported
+ Everything is a property, no special treatment of options
+ Good performance
+ Static options can be hidden from public access
- Private properties wouldn't work, access not allowed from parent classes.
# Services for a bundle are always loaded
# hello configLoad() will be called automatically (if defined)
# Namespaces can be simplified
doctrine:
dbal:
dbname: xxxxxxxx
user: xxxxxxxx
password: ~