[TYPO3-mvc] Using Repository outside extbase

Jochen Rau jochen.rau at typoplanet.de
Tue Jul 14 17:37:46 CEST 2009


Hi Xavier, hi Joerg.

Jochen Rau wrote:
> Ah, no, wait a moment.
>
> Jochen Rau wrote:
>> Hi Xavier.
>>
>>> I have to fix some other issues of the persistence layer first.
>>
>> I am catching up ...
>>
>> The issue should be resolved with r935. After a discussion with
>> Sebastian, we decided to further use the singleton as a global object.
>> The Persistence Manager will be set up at the first call to the
>> dispatcher and can be reached everywhere by saying
>>
>> t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager')
>>
>> Not the best solution (from a software architects perspective), but it
>> works.
>
> That doesn't solve your problem, because the Dispatcher must have been
> invoked at least once before you can use the Persistence Manager inside
> an itemProcFunc.
>
> Hmm. Maybe we can implement a distinct static function. Let's see ....
>
> Jochen
>

I have implemented a method (r936)

Tx_Extbase_Dispatcher::getPersistenceManager();

And changed the Repository constructor method to

	/**
	 * Constructs a new Repository
	 *
	 */
	public function __construct() {
		$this->queryFactory = 
t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
		$this->persistenceManager = 
Tx_Extbase_Dispatcher::getPersistenceManager();
	}

Does it work now for you?


-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list