Pass a variable to a Symfony Form

前端 未结 1 1177
死守一世寂寞
死守一世寂寞 2021-01-03 01:20

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 ha

相关标签:
1条回答
  • 2021-01-03 01:59

    This should work for you...

    In your action:
    
    $this->form = new StudentCourseForm(array(), array('student_id' => $student_id));
    
    In the form class:
    
    $this->getOption('student_id');
    
    0 讨论(0)
提交回复
热议问题