[TYPO3-mvc] How to use an own storage backend / repository

Stefano Kowalke blueduck at gmx.net
Tue Sep 17 14:34:27 CEST 2013


Hey Chris,

thanks for sharing!

> but currently there is no offical way to support
> storageBackends on per extension or model level.

Maybe this change [1] make it possible? I forgot to mention that I use 
latest Extbase and TYPO3 6.1.

> config.tx_extbase.persistence.classes.Tx_UserKimAersignup_Domain_Model_KimSignup.mapping
> {
>    tableName = Tx_UserKimBase_Persistence_Storage_KimDbBackend->tblOnlineAnmeld
> }

I found also this extensions which provides an solr storageBackend [2] 
where the same piece of code:

# Configure ProxyBackend to use the SolrBackend for objects of class 
Tx_MyExt_Domain_Model_MyModel
     persistence {
         tx_nxsolrbackend_proxy {
             classes {
                 Tx_MyExt_Domain_Model_MyModel = 
Tx_Nxsolrbackend_Persistence_Storage_SolrBackend
             }
         }
     }

They just use the model name instead of your tableName. But maybe this 
means the same. I am pretty new to Extbase.

I wondering if I could / should use the QOM to build the query and 
retrive the data from the webservice?

Stefano

[1] http://forge.typo3.org/issues/44796
[2] http://forge.typo3.org/projects/extension-nxsolrbackend/wiki




Am 17.09.13 13:50, schrieb chris Wolff:
> Hi Stefano,
>
> you could switch the storage backen on an per page basis. via
> typoscript. but currently there is no offical way to support
> storageBackends on per extension or model level.
>
> for one of my clients i had hacked such a think but i wasn't able to
> release the code as its currently hackish and client specific. if i
> find the time i might releas it at a later point.
>
> but i can give you an overview of my concept. maybe this helps you get
> started with:
>
> i implemented a Proxy StorageBackend (StorageBackendSwitcher) wich
> selects the right backend for every model.
> and set this StorageBackendSwitcher as the defaultStorageBacken in
> extbase via typoscript:
>
> config.tx_extbase.objects {
>    # Setting the extbase storage backend implentation to use
>    Tx_Extbase_Persistence_Storage_BackendInterface.className =
> Tx_UserKimBase_Persistence_Storage_StorageBackendSwitcher
>    # give my StorageBackendSwitcher an defaultStorage Backend so every
> extbase extension would work as bevore
>    Tx_UserKimBase_Persistence_Storage_StorageBackendSwitcher.defaultStorageBackend
> = Tx_Extbase_Persistence_Storage_Typo3DbBackend
> }
>
>
> if i have a model wich needs a different storage backend i define it
> also via typoscript by encoding the storagebackend name into the table
> name:
>
> config.tx_extbase.persistence.classes.Tx_UserKimAersignup_Domain_Model_KimSignup.mapping
> {
>    tableName = Tx_UserKimBase_Persistence_Storage_KimDbBackend->tblOnlineAnmeld
> }
>
>
> as there is no clean way to define such a thing.
>
> the StorageBackendSwitcher then simply looks if the table name
> contains an "->" if so it splits the table name in parts. and created
> the backend class provided.
> if not present the defaultStoragBackend is used.
>
> this makes it possible to use multiple extbase plugins with different
> storagebackends on the same page.
> be aware that this solution has drawbacks! its no longer possible to
> create relations between models in different storage backends.
> as this soloution is not well tested there might be other problems arising.
>
> regards chris
>
>
>
>
>
>
>
>
>
> 2013/9/17 Stefano Kowalke <blueduck at gmx.net>:
>> Hey list,
>>
>> I write an extbase extension were no database is needed. Actually its just
>> an frontend for a webapi.
>>
>> The extension consist of a searchform with a few filters and fires requests
>> to the webapi (No SOAP, no Rest).
>>
>> In the background its just put together the api url with an api token, the
>> current timestamp and the search paramenters and get XML as response.
>>
>> As far as I understand MVC this would be the job for an repository and and
>> own storageBackend in Extbase.
>>
>> How can I replace the current storageBackend with my custom storageBackend
>> which talks with the api?
>>
>> Thanks in advance
>>
>> Stefano
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
>
>



More information about the TYPO3-project-typo3v4mvc mailing list