[TYPO3-mvc] Using Repositories "standalone"

Michael Knoll mimi at kaktusteam.de
Thu Aug 12 17:22:57 CEST 2010


Hi there,

during the past couple of days, I was trying to write a data source for 
a generic list extension using repositories to get their data from.

As it might be necessery for my question, to understand what I want to 
do, I give you a brief explanation:



We are (re-)writing an extension for generating lists using ExtBase. One 
feature of this extension should be a possibility to render domain 
objects in a list. A possible gimmick could be a viewhelper that renders 
a collection of objects given as parameter.

The extension also contains filters and pagers that can be used on those 
objects. So I cannot put a collection of objects into any kind of list 
renderer and let the extension do the job, but the extension itself has 
to "generate" the data depending on current pager and filter settings.

So here comes my question: Is there any "easy" way to get an instance of 
a repository without faking a dispatchin action. What I'm doing at the 
moment might look a little weird to you...


$dispatcher = new Tx_Extbase_Dispatcher();
         $dataSource = 
Tx_PtExtlist_Domain_DataBackend_ExtBaseDataBackend_ExtBaseDataBackend::createDataSource($this->configurationBuilderMock);
         $extBaseDataBackend = new 
Tx_PtExtlist_Domain_DataBackend_ExtBaseDataBackend_ExtBaseDataBackend();
         $extBaseDataBackend->injectDataSource($dataSource);

         try {
             $dispatcher->dispatch('content', $this->extBaseSettings);
         } catch (Exception $e) {
         	
         }

         $listData = $extBaseDataBackend->getListData();



One thing that's really annoying is the fact, that I initialize static 
properties in Tx_Extbase_Dispatcher by calling a constructor for this 
class... then there are dependencies from Repository to Dispatcher which 
  makes it a little hard to get an instance...

And then there is this big thing concerning configuration... is there 
any documentation on the whole persistence stuff? It took me about 2 
hours to find out, that there is a new configuration "type" inside the 
mapping, which gave me no records from the database when I created the 
records "by hand"...


Thanks a lot for your help... I'm trying to write all the interesting 
stuff on my blog so that others do not have to search as long as I do, 
but I do not want to write anything wrong...


Greez

Mimi


More information about the TYPO3-project-typo3v4mvc mailing list