Bug #65363

Set _languageUid to -1 only if the developer hasn't set it himself

Added by Marco Huber over 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-02-26
Due date:
% Done:

100%

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

Description

When new domain objects get persisted the language field (sys_language_uid) is set to -1 in \TYPO3\CMS\Extbase\Persistence\Generic\Backend::insertObject(). There should be a check if the developer hasn't set it himself.

diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
index f3d89c9..8c6e3f0 100644
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
@@ -633,7 +633,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                $dataMap = $this->dataMapper->getDataMap(get_class($object));
                $row = array();
                $this->addCommonFieldsToRow($object, $row);
-               if ($dataMap->getLanguageIdColumnName() !== NULL) {
+               if ($dataMap->getLanguageIdColumnName() !== NULL && ($object->_getProperty('_languageUid') === NULL || !$object->_getProperty('_languageUid'))) {
                        $row[$dataMap->getLanguageIdColumnName()] = -1;
                }
                if ($parentObject !== NULL && $parentPropertyName) {

If someone has a good idea for a commit message I will submit a patch to gerrit.


Related issues

Related to TYPO3 Core - Bug #65364: _languageUid gets overwritten on updating a new domain object.Closed2015-02-26

Actions
#1

Updated by Gerrit Code Review almost 6 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/43149

#2

Updated by Gerrit Code Review almost 6 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/43149

#3

Updated by Gerrit Code Review almost 6 years ago

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

#4

Updated by Gerrit Code Review almost 6 years ago

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

#5

Updated by Marco Huber almost 6 years ago

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

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF