Bug #65363

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

Added by Marco Huber almost 5 years ago. Updated about 1 year ago.

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

100%

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. Closed 2015-02-26

Associated revisions

Revision 86ac2558 (diff)
Added by Marco Huber about 4 years ago

[BUGFIX] _languageUid property not set on insert

The patch ensures new objects are created with default language only.
Database field and object property are set properly to 0.

Furthermore the language uid is set only if not set before from outside.

Resolves: #65363
Resolves: #65364
Releases: master, 6.2
Change-Id: Ifc777e482ef12dba46938f826548a97758e531a1
Reviewed-on: http://review.typo3.org/41595
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Daniel Goerz <>
Tested-by: Daniel Goerz <>
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>

Revision 4f6d1669 (diff)
Added by Marco Huber about 4 years ago

[BUGFIX] _languageUid property not set on insert

The patch ensures new objects are created with default language only.
Database field and object property are set properly to 0.

Furthermore the language uid is set only if not set before from outside.

Resolves: #65363
Resolves: #65364
Releases: master, 6.2
Change-Id: I57c4834f7e77644620831abeeb2bc2e644f95395
Reviewed-on: http://review.typo3.org/43427
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>

History

#1 Updated by Gerrit Code Review over 4 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 over 4 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 over 4 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 about 4 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 about 4 years ago

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

#6 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF