Developing software in the Real World

ZF2: Using the ServiceManager as an Inversion of Control Container (Part 1)

Reese has posted ZF2: Using the ServiceManager as an Inversion of Control Container (Part 1)

In Zend Framework 1, it was difficult to follow best practices when it came to writing testable code. Sure, you could make testable models, but once you need those models in a controller, what do you do? Zend Framework 2 makes it much easier. In this post, I’ll cover the basics of injecting a model into a controller.

He then goes on to explain how to use the ServiceManager to inject a model entity into a controller either via the Module’s getControllerConfig(). You should also check out part 2.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *