[Flow] Injection of PHP Classes

Robert Lemke robert at typo3.org
Tue Aug 27 10:57:58 CEST 2013


Hi Christian,

Christian Loock wrote:

> I wonder, why I cannot inject Classes provided by PHP.
>
> For Example:
>
> /**
> * @Flow\Inject
> * @var \DOMDocument
> */
> protected $myDomDocument;
>
>
> Does not work. I cant find the class, also it should find it easily.
>
> Any reasons why this does not work?

Currently Flow only considers classes which are managed by its object 
manager, and PHP internal classes are not part of that. It may be 
possible to support your case, but I wonder why you want to inject a 
DOMDocument instead of instantiating one?

It's generally good practice to not inject objects of scope prototype 
because it may be misleading (you might think that you always get the 
same instance injected).

Cheers,
Robert


More information about the Flow mailing list