[BUGFIX] Add property "uidLocal" to extbase FileReference model 17/37417/6
authorJost Baron <jost@netzkoenig.de>
Sun, 1 Mar 2015 16:07:33 +0000 (17:07 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 2 Mar 2015 16:44:11 +0000 (17:44 +0100)
This is needed so extbase persists FileReferences created in the
frontend correctly. Otherwise the field "uid_local" would always
be set to 0 in the database, creating an invalid file reference.

Resolves: #48965
Related: #5718

Releases: 6.2, master
Change-Id: I1e620c18d60546fdc081410b1d27a1b1de6f3e5b
Reviewed-on: http://review.typo3.org/37417
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Domain/Model/FileReference.php

index 71f09d4..a9e5584 100644 (file)
@@ -22,6 +22,22 @@ namespace TYPO3\CMS\Extbase\Domain\Model;
 class FileReference extends \TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder {
 
        /**
+         * Uid of the referenced sys_file. Needed for extbase to serialize the
+         * reference correctly.
+         *
+         * @var integer
+         */
+       protected $uidLocal;
+
+       /**
+        * @param \TYPO3\CMS\Core\Resource\FileReference $originalResource
+        */
+       public function setOriginalResource(\TYPO3\CMS\Core\Resource\FileReference $originalResource) {
+               $this->originalResource = $originalResource;
+               $this->uidLocal = (int)$originalResource->getOriginalFile()->getUid();
+       }
+
+       /**
         * @return \TYPO3\CMS\Core\Resource\FileReference
         */
        public function getOriginalResource() {