[TYPO3-mvc] Question about DI and current component wiring method
Robert Lemke
robert at typo3.org
Wed Aug 5 10:54:42 CEST 2009
Hi Xavier,
Am 05.08.2009 um 10:34 schrieb Xavier Perseguers:
> A question arised in my head this morning regarding Dependency
> Injection
> and I could not find an answer... I understand it and is described
> as a
> way to prevent having explicit dependency on other classes.
>
> Great! But this means the purpose of this is not to have any
> dependency
> and be able to change the actual class implementing a feature by
> another. Now, could someone explain me how it is supposed to work
> _actually_? I mean, suppose I want to provide my own implementation of
> feature X from Extbase, how am I supposed to change the wiring of
> components from Extbase? I don't see as all wiring is done with
> convention.
>
> Is this supposed to be left as this for Extbase? Does FLOW3 have
> wiring
> over configuration instead? Or in addition? I must admit I did not do
> much FLOW3 as Extbase came quite at the "good" point of time ;-)
In practice you would prefer programing to interfaces: Instead of
injecting
an object of specific class you would rather depend on an interface:
/**
* @var \F3\FLOW3\Object\ManagerInterface
* @inject
*/
In FLOW3 you can tweak the actual implementation by altering the
configuration
in an Objects.yaml file:
\F3\FLOW3\Object\ManagerInterface:
className: \F3\MyPackage\Object\ManagerPlusPlus
You see?
robert
More information about the TYPO3-project-typo3v4mvc
mailing list