Created
June 23, 2011 20:15
-
-
Save j/1043520 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 JStout\MainBundle\Form; | |
use Symfony\Component\Form\AbstractType, | |
Symfony\Component\Form\FormBuilder; | |
class CreativeQuestionsType extends AbstractType | |
{ | |
public function buildForm(FormBuilder $builder, array $options) | |
{ | |
$builder | |
->add('question', 'entity', array( | |
'class' => 'JStout\MainBundle\Entity\Question', | |
'query_builder' => function($repository) { return $repository->createQueryBuilder('q')->orderBy('q.question', 'ASC'); }, | |
'property' => 'question' | |
)) | |
->add('pos', 'integer'); | |
} | |
} |
This file contains hidden or 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 JStout\MainBundle\Form; | |
use Symfony\Component\Form\AbstractType, | |
Symfony\Component\Form\FormBuilder; | |
class CreativeType extends AbstractType | |
{ | |
public function buildForm(FormBuilder $builder, array $options) | |
{ | |
$builder | |
->add('name') | |
->add('title') | |
->add('description') | |
->add('body') | |
->add('script') | |
->add('creativeQuestions', 'collection', array( | |
'type' => new CreativeQuestionsType(), | |
'allow_add' => true, | |
'allow_delete' => true | |
)) | |
->add('active'); | |
} | |
public function getDefaultOptions(array $options) | |
{ | |
return array( | |
'data_class' => 'JStout\MainBundle\Entity\Creative' | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment