[TYPO3-mvc] Benefit of DI when referencing to a class (and not to an interface)?

Roland most.wanted at gmx.at
Wed Jun 27 15:14:43 CEST 2012


hi.

thanks for your answer.

do you all agree, that you should use DI with reference to interfaces 
(and not classes) where possible?

kind regards

roland



Am 27.06.12 08:22, schrieb Karsten Dambekalns:
> Hi.
>
> On 26.06.12 11:52, Roland wrote:
>> do you really reduce dependency with this?
>>
>> --- quote ---
>>
>> /**
>>   * @var Tx_Foo_Domain_Repository_BarRepository
>>   * @inject
>>   */
>> protected $barRepository;
>>
>> --- /quote ---
>>
>> aren't you still dependent on a class named
>> Tx_Foo_Domain_Repository_BarRepository?
>
> Yes, you are. But at least you are not dependent on (a certain)
> ObjectManager anymore.
>
>
> Regards,
> Karsten



More information about the TYPO3-project-typo3v4mvc mailing list