[BUGFIX] Fix persisting new objects
authorStefan Froemken <froemken@gmail.com>
Thu, 25 Apr 2013 16:29:13 +0000 (18:29 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 27 Apr 2013 11:19:34 +0000 (13:19 +0200)
While adding new records, extbase throws:
The given row must contain a value for "uid"

This is a follow up to introducing explicit saving
of modified domain objects, where the lines inserting new
objects was removed.

Fixes: #47546
Related: #47251
Releases: 6.2, 6.1
Change-Id: I8f3e9eef86e989c5092a1b5f312151e2bd78a790
Reviewed-on: https://review.typo3.org/20134
Reviewed-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index a1cf9f2..ad2f8d5 100644 (file)
@@ -361,6 +361,9 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        protected function persistObjects() {
                $this->visitedDuringPersistence = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
                foreach ($this->aggregateRootObjects as $object) {
+                       if ($object->_isNew()) {
+                               $this->insertObject($object);
+                       }
                        $this->persistObject($object, NULL);
                }
                foreach ($this->changedEntities as $object) {