[TYPO3-dev] Extbase: translation handling

Alexander Bigga linux at bigga.de
Wed Jul 30 11:28:19 CEST 2014


Hi Cornel,

first: which version of Extbase/TYPO3 do you use? That's ovious to you
but not for the reader ;-)

I remember, that I had similar problem with the localization of parent
elements (categories) in slub_events in Extbase 4.7. That's why I do it
the dirty way in my getParentUidLocalized() method inside the
CategoryRepository.

https://forge.typo3.org/projects/extension-slub_events/repository/changes/trunk/Classes/Domain/Repository/CategoryRepository.php

Maybe this inspires you ;-)

Best regards,

Alexander

Am 29.07.2014 um 18:15 schrieb Cornel Widmer:
> Hi folks
> 
> I really didn't get it how extbase and the repository should work in
> case of translation handling. Currently working on an extension where
> each record can be translated and abstracted it is a very simple one.
> 
> There are some hotels and some categories. The categories are
> relationship child-parent and each hotel can have multiple assignments
> to the category tree.
> 
> Now I've setup a frontend-plugin with a flexform in the backend where
> you can choose wich categories should be displayed. In the controller I
> fetch this list of categories and query the database trough the
> repository. For this purpose I wrote a method by myself "findByUids".
> 
> In the default language everythings works fine. Then I translate all
> categories and hotels in the backend and also make a translation of the
> page and the included content-element. Now the plugin has already the
> defined categories from the default language (a list of uids).
> 
> Now in the frontend no categories are displayed and also not hotels are
> visible. When I change the uids of the categories in the flexform
> manually - because I'm not able to change the flexform-query in a proper
> way to achive that only translated categories are visible - the
> translated categories are visible.
> 
> HOW should this work?
> 
> And there is also an other issue: if no categories are selected I want
> to start with the root categories. So I wrote an other function in my
> repository -> findRootCategories. Sounds easy. But when this method is
> called on the translated page EVERY! translated category is returned
> because in the translated entrys the parent property is set to 0.
> 
> public function findRootCategories () {
> 
>     // create query object
>     $query = $this->createQuery();
> 
>     // build query
>     $query->matching(
>         $query->logicalAnd(
>             $query->equals('parent', 0)
>         )
>     );
> 
>     // return result
>     return $query->execute();
> 
> }
> 
> I'm really annoyed by extbase right now. Is there someone who has a
> proper solution for this problem?
> 
> PS: Its possible to give you more code if requested.
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev



More information about the TYPO3-dev mailing list