Skip to content

Instantly share code, notes, and snippets.

@alxfv
Created May 29, 2014 13:21
Show Gist options
  • Save alxfv/fb9ffd6bcf7b69b0e61c to your computer and use it in GitHub Desktop.
Save alxfv/fb9ffd6bcf7b69b0e61c to your computer and use it in GitHub Desktop.
<?php
class AppController extends Controller
{
/**
* @Route("/test-collection-form", name="test-collection-form")
* @Template()
*/
public function testCollectionFormAction(Request $request)
{
$data = null;
$data['test'] = [
'default 1',
'default 2',
'default 3',
];
$form = $this->createFormBuilder($data)
->add('test', 'collection', [
'type' => 'text',
'allow_add' => true,
'prototype' => true,
])
->add('submit', 'submit')
->getForm()
;
return ['form' => $form->createView()];
}
}
/**
Шаблон:
<html>
<body>
{{ form(form) }}
</body>
</html>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment