Zend AMF Custom Manager

Can I use a custom manager when using Zend_AMF?

I know that I can pass either the class name or the object for setClass () for Zend_AMF.

However, when I pass the setClass object, it does not seem to save a copy of this object. Instead, it processes the name of the class, and then instantiates the copy of the object itself.

This is a problem since I am using the yadif dependency injection container. Objects must be created using constructor dependencies and / or property dependencies.

Since the Zend_Amf dispatcher runs all instances, I cannot introduce constructor dependencies and other dependencies to my objects.

If anyone has a strategy on how I can overcome this without touching any code in Zend_AMF, that would be great :)

0
source share
1 answer

The solution is to basically create a wrapper around Zend_Amf. The way it is written means that I had to copy most of the code in the handle and _handle () methods. Then I had to change some of the called methods to point to the Zend_Amf instance that I created.

Finally, the dispatch was changed so that my own dispatcher was called and the results returned.

Obviously, this is not the most elegant solution, but I hope they redesign Zend_AMF to be a bit more extensible in the future and let us easily get into it.

At the moment, I can still easily download the updated version of Zend_AMF to the vendors folder without changing the code.

0
source

Source: https://habr.com/ru/post/910680/


All Articles