Created
October 26, 2012 10:21
-
-
Save sorbing/3958033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\CommonBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
class TaskType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
$builder->add('task'); | |
$builder->add('dueDate', 'date'); | |
$builder->add('description', 'textarea', array('required' => false)); | |
$builder->add('tagId'); | |
} | |
/** | |
* Set a class that holds the underlying form data (класс с данными формы) | |
* @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver | |
*/ | |
public function setDefaultOptions(OptionsResolverInterface $resolver) | |
{ | |
$resolver->setDefaults(array( | |
'data_class' => 'App\CommonBundle\Model\Task', | |
)); | |
} | |
public function getName() | |
{ | |
return 'task'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment