Pass a variable to a Symfony Form

Posted by Juan Besa on Stack Overflow See other posts from Stack Overflow or by Juan Besa
Published on 2010-05-18T00:09:36Z Indexed on 2010/05/18 1:50 UTC
Read the original article Hit count: 440

Filed under:
|
|

Hi,

I am building a web application using Symfony 1.4 and Doctrine for a school and I want to make a very simple form to add a course to a student.

The main problem I have is that in the drop down list I only want to show the courses in which the student is currently not enrolled.

I already have a function in the model (in Student.class.php) which returns all the courses in which the student is not enrolled but the problem is I don't know how to pass the student to the configure() of the form. I have tried several options like passing it with the constructor of the form to a global variable or a special set method but none of them have worked.

Is there any form to pass the student to the configure() method?

Thanks!

© Stack Overflow or respective owner

Related posts about symfony

Related posts about forms