Project

General

Profile

Actions

Bug #59992

closed

Persistence session doesn't take overlays into account

Added by Mathias Brodala over 10 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-06-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

ATM the DataMapper only allows for mapping one record per UID but not additional instances like localized records (e.g. as built by record overlay).

These have the same UID value but their own UID in a separate field (_LOCALIZED_UID). This should be taken into account to allow for mapping localized records in a single session (e.g. for importing data including translations).


Files

datamapper-localizations.patch (1.33 KB) datamapper-localizations.patch Enable mapping of localized records Mathias Brodala, 2014-06-30 11:31

Related issues 5 (2 open3 closed)

Related to TYPO3 Core - Bug #45873: querySettings setRespectSysLanguage or setSysLanguageUid does not workClosed2013-02-27

Actions
Related to TYPO3 Core - Bug #86405: querySetting setRespectSysLanguage (wrong implementation of "strict"-mode)New2018-09-27

Actions
Related to TYPO3 Core - Bug #105319: Extbase domain model combined identity for localized entriesNew2024-10-16

Actions
Has duplicate TYPO3 Core - Bug #78026: get translation of extbase object / persistenceSession does not track languagesClosed2016-09-21

Actions
Has duplicate TYPO3 Core - Bug #81126: After $querySettings()->setLanguageUid(1); it doesn't change.Closed2017-05-03

Actions
Actions #1

Updated by Gerrit Code Review almost 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35163

Actions #2

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35163

Actions #3

Updated by Mathias Schreiber almost 10 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)
Actions #4

Updated by Benni Mack over 9 years ago

  • Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
Actions #5

Updated by Mathias Brodala over 9 years ago

This one can be closed as WONTFIX or put on hold, see the linked change.

Actions #6

Updated by Marc Bastian Heinrichs over 9 years ago

  • Tracker changed from Feature to Bug
  • Subject changed from Allow for mapping localized records in a single session to Persistence session doesn't take overlays into account
  • Description updated (diff)
  • Status changed from Under Review to Accepted
  • TYPO3 Version set to 6.2
  • Is Regression set to No

I would say, that is a bug and needs to be tackled. For sure in a different way like in the abandoned patch.

Actions #7

Updated by Daniel Siepmann over 9 years ago

Even using the workaround will still use the same uid for both objects. Saying that, it can create issues while updating the translated record ...
Fixed that for myself by overwriting the getUid() to return _localizedUid if set.:

    public function getUid()
    {
        if($this->_localizedUid > 0) {
            return (int) $this->_localizedUid;
        }
        return parent::getUid();
    }

The workaround is to unregister the entity from the persistence session:
persistenceSession->unregisterObject($entity); where you have to instantiate the persistence Session \TYPO3\CMS\Extbase\Persistence\Generic\Session first via inject or ObjectManager. E.g. inside of your Repository.

Actions #8

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #9

Updated by Benni Mack about 9 years ago

  • Target version deleted (7.5)
Actions #10

Updated by Tymoteusz Motylewski about 6 years ago

  • TYPO3 Version changed from 6.2 to 9
  • PHP Version deleted (5.3)

The issue does still exist in v9.

having query like (where post:2 is in lang 0 and post:11 is translation of post:2)

  $query = $this->postRepository->createQuery();
        $querySettings = $query->getQuerySettings();
        $querySettings->setLanguageUid(0);
        $querySettings->setStoragePageIds([20]);
        $query->matching($query->equals('uid', 2));
        $post2 = $query->execute()->getFirst();

and then query like:

        $query = $this->postRepository->createQuery();
        $querySettings = $query->getQuerySettings();
        $querySettings->setLanguageUid(1);
        $querySettings->setStoragePageIds([20]);
        $query->matching($query->equals('uid', 11));
        $post2 = $query->execute()->getFirst();

You'll get different results depending which query is run first.
or whether you run stuff like

$this->persistenceManager->clearState();

between queries.

In order to get this thing fixed and avoid breaking other things I see following path:
1) extend existing test suite with tests covering translated records and/or rendering of the translated page
- test for building links pointing to an extbase record (when viewing a page with L=1, checking objects with and without translation parent)
- test for form _identity rendering (creating/editing records)
- test for calling findByUid(2) and then findByUid(11) with and without clearing session between calls (while being in the L=1)
2) try to introduce better cache identifier for persistance session

Actions #11

Updated by Tymoteusz Motylewski about 6 years ago

  • Related to Bug #45873: querySettings setRespectSysLanguage or setSysLanguageUid does not work added
Actions #12

Updated by Tymoteusz Motylewski about 6 years ago

  • Has duplicate Bug #81126: After $querySettings()->setLanguageUid(1); it doesn't change. added
Actions #13

Updated by Tymoteusz Motylewski about 6 years ago

  • Related to Bug #86405: querySetting setRespectSysLanguage (wrong implementation of "strict"-mode) added
Actions #14

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75099

Actions #15

Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75099

Actions #16

Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75099

Actions #17

Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75099

Actions #18

Updated by Benni Mack over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #19

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions #20

Updated by Garvin Hicking about 1 month ago

  • Related to Bug #105319: Extbase domain model combined identity for localized entries added
Actions

Also available in: Atom PDF