Symfony form choice default value from entity
<p>I having some troubles with symfony forms.
I have a boolean variable in my entity. I cant find a way to set that value in my form when i'm editing it.</p>

<p>Entity </p>

<pre><code>namespace AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity
 * @ORM\Table(name="pages")
 */
class Page
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="text")
     */
    protected $slug;

    /**
     * @ORM\Column(type="text")
     */
    protected $title;

    /**
     * @ORM\Column(type="text")
     */
    protected $content;

    /**
     * @ORM\Column(name="creation_date", type="datetime")
     */
    protected $creationDate;

    /**
     * @ORM\Column(name="is_active", type="boolean")
     */
    protected $isActive = true;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this-&gt;id;
    }

    /**
     * Set slug
     *
     * @param string $slug
     *
     * @return Page
     */
    public function setSlug($slug)
    {
        $this-&gt;slug = $slug;

        return $this;
    }

    /**
     * Get slug
     *
     * @return string
     */
    public function getSlug()
    {
        return $this-&gt;slug;
    }

    /**
     * Set title
     *
     * @param string $title
     *
     * @return Page
     */
    public function setTitle($title)
    {
        $this-&gt;title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this-&gt;title;
    }

    /**
     * Set content
     *
     * @param string $content
     *
     * @return Page
     */
    public function setContent($content)
    {
        $this-&gt;content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string
     */
    public function getContent()
    {
        return $this-&gt;content;
    }

    /**
     * Set creationDate
     *
     * @param \DateTime $creationDate
     *
     * @return Page
     */
    public function setCreationDate($creationDate)
    {
        $this-&gt;creationDate = $creationDate;

        return $this;
    }

    /**
     * Get creationDate
     *
     * @return \DateTime
     */
    public function getCreationDate()
    {
        return $this-&gt;creationDate;
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return Page
     */
    public function setIsActive($isActive)
    {
        $this-&gt;isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this-&gt;isActive;
    }
}
</code></pre>

<p>Controller function</p>

<pre><code>public function editAction(Request $request, $pageId)
    {   
        $em = $this-&gt;getDoctrine()-&gt;getManager();

    $page = $em-&gt;getRepository('AdminBundle:Page')-&gt;find($pageId);

        $form = $this-&gt;createForm('app_page', $page);

        $form-&gt;handleRequest($request);

    if($form-&gt;isValid()) {
            $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
            $em-&gt;persist($page);
            $em-&gt;flush();

            return $this-&gt;redirectToRoute('admin_pages');
        }

    return $this-&gt;render('AdminBundle::editPage.html.twig', array('page' =&gt; $page, 'form' =&gt; $form-&gt;createView()));
    }
</code></pre>

<p>PageFormType </p>

<pre><code>namespace AdminBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class PageFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
    $builder-&gt;add('title', 'text');
        $builder-&gt;add('slug', 'text');
        $builder-&gt;add('isActive', 'choice', array('choices' =&gt; array(
            'true' =&gt; 'Active',
            'false' =&gt; 'Inactive'
        )));
        $builder-&gt;add('content', 'textarea', array('required' =&gt; false));
    }

    public function getName()
    {
        return 'app_page';
    }
}
</code></pre>

<p>As you can see i wrote my self in FormType class what choices it has. And now it is always displaying "Active" instead of displaying Entity's value. How should i do that? </p>

<p>Thanks!</p>