How can i create a select list with values from a database table in Symfony 2?

I have 2 entities: **Student** and **Classroom** with a ManyToOne relationship and i need to create a form with the folowing fields: **name**, **surname**, **age**, **classroom**(select list from available classes).

In my **Student Form** i have

```
    $builder
        ->add('name')
        ->add('surname')
        ->add('age')
        ->add('classroom', new ClassroomType())
    ;

```

In my **Classroom Form** i have this:

```
    $classrooms =$this->getDoctrine()->getRepository('UdoCatalogBundle:Classroom')->findAll();
    $builder
        ->add('clasa','choice',array('choices' => array($classrooms->getId() => $classrooms->getName())));

```

I get this following error:

```
Fatal error: Call to undefined method Udo\CatalogBundle\Form\ClassroomType::getDoctrine() in /var/www/html/pos/src/Udo/CatalogBundle/Form/ClassroomType.php on line 13         

```

Kind Regards,
Cearnau Dan