class UserPhoneFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('phone', 'collection',
array(
'type' => 'Acme\DemoBundle\Form\PhoneTypeForm',
))
->add('note')
->add('button', 'submit');
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Acme\DemoBundle\Entity\UserPhone',
));
}
public function getName()
{
return 'user_phone_form';
}
}
class PhoneFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'entity',
array(
'class' => 'AcmeDemoBundle:Phone',
'property' => 'name'
));
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Acme\DemoBundle\Entity\Phone'
));
}
public function getName()
{
return 'phone_form';
}
}
$form = $this->createForm('user_phone_form');
<form action="" method="post" name="user_phone_form">
<div>
<label class="required">Phone</label>
<div id="user_phone_form_phone"></div>
</div>
<div>
<label class="required" for="user_phone_form_note">Note</label>
<input type="text" required="required" name="user_phone_form[note]" id="user_phone_form_note">
</div>
<div>
<button name="user_phone_form[button]" id="user_phone_form_button" type="submit">Button</button>
</div>
<input type="hidden" value="SYqFs9zwNLN9djTMnmNuppLTEdvBHBUg_u2_Di5mchE" name="user_phone_form[_token]" id="user_phone_form__token">
</form>
Call Stack:
0.0010 128696 1. {main}() C:\OpenServer\domains\phpunit\phpunit:0
0.0080 577680 2. PHPUnit_TextUI_Command::main() C:\OpenServer\domains\phpunit\phpunit:55
0.0080 581264 3. PHPUnit_TextUI_Command->run() C:\OpenServer\domains\phpunit\src\TextUI\Command.php:132
0.0120 815176 4. PHPUnit_Runner_BaseTestRunner->getTest() C:\OpenServer\domains\phpunit\src\TextUI\Command.php:153
20.3982 1240824 5. PHPUnit_Framework_TestSuite->addTestFiles() C:\OpenServer\domains\phpunit\src\Runner\BaseTestRunner.php:97
20.3982 1306720 6. PHPUnit_Framework_TestSuite->addTestFile() C:\OpenServer\domains\phpunit\src\Framework\TestSuite.php:411
20.3992 1336136 7. PHPUnit_Util_Fileloader::checkAndLoad() C:\OpenServer\domains\phpunit\src\Framework\TestSuite.php:358
20.3992 1336328 8. PHPUnit_Util_Fileloader::load() C:\OpenServer\domains\phpunit\src\Util\Fileloader.php:77
20.4002 1339584 9. include_once('C:\OpenServer\domains\acme.lc\src\Acme\DemoBundle\Tests\Controller\AdminControllerTest.php') C:\OpenServer\domains\phpunit\src\Util\Fileloader.php:93
var id = explode('-', $('[id^=item);
id = id[1];
$(['input']).data('id');