[Flow] Dependency Injection and external Libraries

Christian Loock chl at vkf-renzel.de
Fri Jul 19 11:04:31 CEST 2013


Hello,

I encountered an interesting problem while using Flows DI with an 
external Library (Solarium).

Some Interfaces of the Solarium Library define the __construct method. 
However, Flow does Change the __construct methods of cached objects, in 
the generated class. The constructor defined here does not have any 
arguments but instead call the parents constructer with 
call_user_func_array.

This will lead into a Fatal Error, because the the generated class still 
implements the original interface, which has a parameter declared for 
the constructor.

The only way that i managed to get this to work now, is by editing the 
interfaces. But of course, that is nothing that i really want to do, 
because its a third party library.

There is one question and a suggestion I have now.

The question is: Is there another way then changing the interface to 
solve the problem.

The sugesstion I would make to solve this, is to remove the "implements" 
statement from the generated class. Since the generated class extends 
the original, it should still stay true to the interface, right?

Thanks a lot,

Christian


More information about the Flow mailing list