I have a symfony form that its initialized with this code
$this->form =new MyForm();
$this->form->setDefault('myValue',"value");
now if I go to MyForm.class.php and execute
echo $this->getObject()->get('myValue');
die();
on configure() method, it doesnt print anything. Same happens in BaseMyForm.class.php.
Am I doing something wrong?
if I print the entire widget in the html with
<?php echo $form['myValue']->renderError() ?>
<?php echo $form['myValue']->render() ?>
it loads correctly.
It seems I was wrong about how form builder works, when you pass data through
$this->form->setDefault();it is not loaded in the configure method. If you need to pass data to your configure method you have to do it through your builder, in my case it would be something like:and then to read it you need to use
in your configure method
seen on Pass a variable to a Symfony Form