[BUGFIX] Add property "uidLocal" to extbase FileReference model 63/37463/2
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:45:00 +0000 (17:45 +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/37463
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Domain/Model/FileReference.php

index 4109203..cb07014 100644 (file)
@@ -21,6 +21,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() {