This is in response to the use of DI on Abstract Classes. The discussion originated here but I think it is a matter of importance so i am turning this into a blog post.
hi Bernhard, I don’t think he has listened you yet, judging for his latest post on collection forms he still passes does it twice:
Here:
$form = $this->createForm(new \Khepin\GolfBundle\Form\ParSetType($course)); // should be $form = $this->createForm(new \Khepin\GolfBundle\Form\ParSetType(), $course); |
And here:
$builder->get('holes')->add('hole_'.$i, new HoleType($hole)); // should be $builder->get('holes')->add('hole_'.$i, new HoleType(), $hole); // <--- Is this possible!!! I wonder about the add signature!! |
So I found out there is a space for a data option here:
So the code should now look like:
$builder->get('holes')->add('hole_'.$i, new HoleType(), array( 'data' => $hole ) ); |
I have not tried if this works but at least it has some support.
@Bernhard can you please help me out with the last part? how it should be done?
thanks! I will update this blog post as this is resolved.