use Symfony\Component\HttpFoundation\RequestStack;
6
7
class FormManager
8
{
9
private $requestStack;
10
private $creators;
11
12
public function __construct(RequestStack $requestStack)
13
{
14
$this->creators = new \SplPriorityQueue;
15
$this->requestStack = $requestStack;
16
}
17
18
public function createObjectForm($object, $purpose = null, array $options = array())
19
{
20
foreach ($this->getCreators() as $creator) {
21
if ($form = $creator->create($object, $purpose, $options)) {
22
return $form;
23
}
24
}
25
26
throw new \RuntimeException(sprintf('The form manager was unable to create the form. Please, make sure you have correctly registered one that fit your need.'));
27
}
28
29
public function createBoundObjectForm($object, $purpose = null, array $options = array())