<?php
    # CONTROLLER METHOD
    /**
     * @Route("/", name="foobarIndex")
     */
    public function indexAction(){
        $repo = $this->getDoctrine()->getRepository('AcmeDemoBundle:Foo');

        $form = $this->createForm(new \Acme\DemoBundle\Form\FooType($repo));

        return array(
            'form' => $form->createView()
        );
    }
    
    # FORM TYPE
    class FooType extends AbstractType
    {
        /**
         * @var \Acme\DemoBundle\Entity\FooRepo
         */
        private $repository;
    
        /**
         * We are going to pass entity repository object but might as well pass data only
         */
        function __construct($repository)
        {
            $this->repository = $repository; // store it, we are going to use it later
        }
    
        public function buildForm(FormBuilderInterface $builder, array $options)
        {
            $builder
                ->add('someChoiceField', 'choice', array(
                    'choices' => $this->repository->someFooMethod() # returns array() of Foo objects
                ));
                
            # Please make sure to form your array properly, 
            # e.g. primary key => textual represenation, or at lease have __toString overriden
        }
    
        public function getName()
        {
            return 'acme_demobundle_footype';
        }
    }    
?>