[TYPO3-mvc] Adding new records does not consider newRecordStoragePid

Dirk Rauscher dr_typo3 at itb-institut.de
Mon Aug 15 11:29:17 CEST 2011


Hello Franz,

i'm actually using extbase version 1.3.1 devel and typo3 version 4.5.4.
I call this outside a extbase context in a class 
(tx_itbmemento_service_flash) where i include required classes from 
extbase. The constructor of tx_itbmemento_service_flash makes an 
instance of Tx_Extbase_Dispatcher.

Meanwhile i solved the problem by calling this code:

         $bs = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
         
$bs->initialize($GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.']['itbmemento_pi1.']);

These lines ensure, that the configurationManager knows which 
extension's configuration has to be loaded.

While a new record is stored, the pid 
(TS[plugin][MYEXT][persistence][classes][MYCLASS][newRecordStoragePid]) 
where it should be stored, is received from 
determineStoragePageIdForNewRecord() which is a method of class 
Tx_Extbase_Persistence_Backend. This in turn calls the 
Tx_Extbase_Configuration_AbstractConfigurationManager::getConfiguration() method 
to get a merged TS configuration array. This is where it get's "tricky". 
Only if $extensionName and $pluginName is known, the right TS 
configuration is merged to the extbase config. Otherwise the only thing 
you get is the extbase' configuration from TS[config][tx_extbase].

It took me some time to find out how it works...
Is there an more correct way to let the configurationManager know in 
which extensions context the method call is done?

Cheers Dirk


Am 14.08.2011 11:59, schrieb Franz Koch:
> Hi,
>
>> my extension recieves a data array from a flash application and makes a
>> domain model object from it.
>> Now i want to store this object as a new record in the database.
>> Therefore i call this code that works as expected:
>>
>> ...
>> require_once(t3lib_extMgm::extPath('itb_memento').'Classes/Domain/Repository/ItemFlashPropertyRepository.php'); 
>>
>>
>>
>> $repo =
>> t3lib_div::makeInstance('Tx_ItbMemento_Domain_Repository_FlashAppStateRepository'); 
>>
>>
>> $repo->add($obj);
>> $repo->_persistAll(); #this method calls the repository's
>> persistenceManager persistAll() method
>> ...
>
> in which context do you call this? Inside a controller dispatched from 
> Extbase or somewhere outside a Extbase environment?
> And which Extbase version are you using (1.2.x I suppose)?
>



More information about the TYPO3-project-typo3v4mvc mailing list