Skip to content

Instantly share code, notes, and snippets.

@khepin
Created October 16, 2012 03:33
Show Gist options
  • Save khepin/3897106 to your computer and use it in GitHub Desktop.
Save khepin/3897106 to your computer and use it in GitHub Desktop.
namespace Acme\DemoBundle\Form\Type;
<?php
use Symfony\Component\Form\AbstractType
use Symfony\Component\Form\FormBuilderInterface;
use Acme\DemoBundle\Form\EventListener\AddNameFieldSubscriber;
class ProductType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$subscriber = new AddNameFieldSubscriber($builder->getFormFactory());
$builder->addEventSubscriber($subscriber);
$builder->add('price');
}
public function getName()
{
return 'product';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment