Tuesday, 5 November 2013

A solution to dependency injection into multiple nested ZF2 fieldset classes

After a couple of days spent trying to get the ZF2 Element Manager to let me inject services into my nested fieldsets, I found a solution which seems to work with minimal changes to the Element Manager example or fieldset classes.

Note: My project was slightly different, but, I'll describe my solution in the context of ZF2's own Form Collections documentation. I have also posted this solution in the comments of the ZF website.