Skip to content

Instantly share code, notes, and snippets.

@khepin
Created October 16, 2012 03:44
Show Gist options
  • Save khepin/3897130 to your computer and use it in GitHub Desktop.
Save khepin/3897130 to your computer and use it in GitHub Desktop.
<?php
namespace Acme\WhateverBundle\FormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Acme\WhateverBundle\FormSubscriber\UserListener;
class FriendMessageFormType extends AbstractType
{
private $subscriber;
public function __construct(UserListener $subscriber)
{
$this->subscriber = $subscriber;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('subject', 'text')
->add('body', 'textarea')
;
$builder->addEventSubscriber($this->subscriber);
}
public function getName()
{
return 'acme_friend_message';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment