Hi There,
I am currently working on a project and something very odd is occuring. I am instantiating a form and passing a variable to it from the controller. However, the variable is not being passed. If I perform a var_dump()
in the controller on the last line before it is passed to the form, I can see the variable as expected. However, if I perform the same var_dump()
command on the first line of the form, it returns NULL
. I have attached a code snippet below, which works correctly on other controllers and forms:
Here is the code in the controller
public function someAction($var){
$form = new formExample();
var_dump($var); //Outputs Correct Variable
$form->initialize($var);
$this->view->form = $form;
}
Here is the code in the form.
class formExample extends FormBase
{
public function initialize($var)
{
var_dump($var); //Outputs NULL
}
}
If anyone could provide advice it would be greatly appreciated.
Regards