Collection as Symfony Form
<p>I have a collection of entities called FooCollection. This collection is build from a API response. I don't use doctrine. The entities are instance of class Foo and each hold a class named Bar. I generate in the template a formular list like:</p>

<pre><code>&lt;form&gt;
    &lt;ul&gt;
    {% for foo in fooCollection %}
        &lt;li&gt;&lt;input type="checkbox" name="foo[{{foo.id}}]" value="1"&gt; &lt;label&gt;{{foo.bar.title}}&lt;/label&gt;&lt;/li&gt;
    {% endfor %}
    &lt;/ul&gt;
&lt;/form&gt;
</code></pre>

<p>Is it possible to use Symfony2 Forms to create this form list and how can I do that?</p>

<p>Here are the example entities and collections:</p>

<pre><code>&lt;?php

class Foo
{
    private $bar;
    private $id;

    public function getId()
    {
        return $this-&gt;id;
    }

    public function setBar(Bar $bar)
    {
        $this-&gt;bar = $bar;
    }

    public function getBar()
    {
        return $this-&gt;bar;
    }
}

class Bar
{
    private $title;

    public function getTitle()
    {
        return $this-&gt;title;
    }
}

class FooCollection extends \Doctrine\Common\Collections\ArrayCollection
{
}
</code></pre>