[TYPO3-mvc] RFC #9062: prepare objectManager to become the central factory

Felix Oertel mehl at foertel.com
Tue Jul 27 23:50:41 CEST 2010


This is an SVN patch request.

Type:
=====

Feature

Bugtracker references:
======================

http://forge.typo3.org/issues/9062

Branches:
=========

trunk

Problem:
========

in FLOW3 the ObjectManager plays a much more important role. He is in 
charge of creating, holding and returning objects and taking care of 
stuff like dependency injection.

As we want to have dependency injection (later on) and stay in sync with 
FLOW3 (at least as far as possible and useful), I think it is important 
to let the ObjectManager become the central place to handle our objects. 
We should not call t3lib_div::makeInstance() directly since this will 
prevent further handling of the genrated objects.

Solution:
=========

The attached patch makes the objectManager globally available and static 
callable. Getting your object was never that easy ;-) 
Tx_Extbase_Object_Manager::get('Your_Object_Name');

I changed some naming in the objectManager to match the naming in FLOW3. 
And I replaced all calls to the objectManager to be static. 
Addiotionally I marked all uses of objectManager-instances deprecated. 
Everything is fully backwards-compatible.

Notes:
======

Unfortunately some of the unit-tests broke. At the moment it's not 
possible to mock static methods with phpunit. Anyway I think we should 
not make our architectual decisions based on phpunit. ;-)

regards, foertel


More information about the TYPO3-project-typo3v4mvc mailing list