So the upgrade from symfony 2.8 to 3.0 (or to 3.4 actually which is the goal for now) which I have been dragging my feet with is every bit as troublesome as some of the previous minor updates. Some frameworks just love forcing you to rewrite code, I guess...
Anyways, I know this has been treated in a number of other posts, but I want to make it foolproof, like a "symfony forms for dummies" moving your forms from symfony 2.8 to 3.0.
If you run your app through app_dev.php you get nice hints in the footer regarding what is deprecated, in other words what won't work in version 3.0.
The deprecation message for this particular issue is:
Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead
The first thing I had to do about my forms was to change the way they are called from the controller. The symfony documentation is satisfied in saying:
Before:
$form = $this->createForm(new MyType());
After:
$form = $this->createForm(MyType::class);
But hold on, how then do I pass in my variables?? My form calls look more like this:
$form = $this->createForm(new extraOpeningType($user), $extraOpening);
I pass both the entity to match with the form, and an additional entity for permission purposes. Not big enough of an issue for the nice changelog guys at Sensiolabs to even comment on it.