I'm trying to use a dependency injection container for the first time in a project, but I just discovered a problem that I'm not sure how to address.
The project provides a SOAP web service, which is implemented atop the SOAP component of Zend Framework. The way this works is that you define a class that acts as your service, you create a Zend_Soap_AutoDiscover or Zend_Soap_Server class (for the WSDL or the class itself, as appropriate), and finally, you pass ZF the name of the service class via the constructor or via the setClass method. For example:
class MyService {}
$autodiscoveryObj = new Zend_Soap_AutoDiscover();
$autodiscoveryObj->setClass('MyService');
...
The problem is with that last step. My DI container can create a service object and inject into it all the required dependencies. That's fine if I need an instance in my own code. However, b/c you just pass the name of the class into ZF, and you don't get to actually instantiate it yourself, it doesn't get properly instantiated through the container so its dependencies are never injected. Further, I don't think I can use any sort of wrapper class, as ZF uses reflection on the class.
What's the best way to handle this?
In Zend_Soap_Server you can attach/set an object like in SoapServer
/**
* Attach an object to a server
*
* Accepts an instanciated object to use when handling requests.
*
* @param object $object
* @return Zend_Soap_Server
*/
public function setObject($object)