Skip to content

Instantly share code, notes, and snippets.

@wouterj
Created May 27, 2013 18:12
Show Gist options
  • Select an option

  • Save wouterj/5658367 to your computer and use it in GitHub Desktop.

Select an option

Save wouterj/5658367 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class StudentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
$builder->add('score', 'integer', array(
'value' => ...
));
}
public function getName()
{
return 'student';
}
}
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class TaskType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
$builder->add('activities', 'collection', array(
'type' => new StudentType(),
));
}
public function getName()
{
return 'task';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment