[TASK] Rename property, getter and setters of File Model
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 8 Nov 2012 15:45:37 +0000 (16:45 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 13 Jan 2013 14:13:08 +0000 (15:13 +0100)
To be in line with TYPO3 Flow, rename the properties from
non speaking "object" to "originalResource"

This change did not make it into 6.0 final, but still should
be part of the 6.0 branch. Since the file models were not
usable anyway because of a bug in the data mapper
(see #10770), it's safe to rename these.

Resolves: #44255
Releases: 6.0, 6.1

Change-Id: Id9efe02a80e29e1ac6a4f6697f104bfb59e51399
Reviewed-on: https://review.typo3.org/17287
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Reviewed-by: Mattias Nilsson
Reviewed-by: Stefan Neufeind
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extbase/Classes/Domain/Model/AbstractFileFolder.php
typo3/sysext/extbase/Classes/Property/TypeConverter/AbstractFileFolderConverter.php
typo3/sysext/extbase/Classes/Property/TypeConverter/FileConverter.php
typo3/sysext/extbase/Classes/Property/TypeConverter/FileReferenceConverter.php
typo3/sysext/extbase/Classes/Property/TypeConverter/FolderConverter.php
typo3/sysext/extbase/Tests/Functional/Domain/Model/FileContextTest.php

index 294f2f0..4482125 100644 (file)
@@ -35,23 +35,23 @@ namespace TYPO3\CMS\Extbase\Domain\Model;
 abstract class AbstractFileFolder extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
 
        /**
-        * @var \TYPO3\CMS\Core\Resource\ResourceInterface|\TYPO3\CMS\Core\Resource\Folder|\TYPO3\CMS\Core\Resource\AbstractFile
+        * @var \TYPO3\CMS\Core\Resource\ResourceInterface|\TYPO3\CMS\Core\Resource\AbstractFile|\TYPO3\CMS\Core\Resource\Folder|\TYPO3\CMS\Core\Resource\FileReference
         */
-       protected $object;
+       protected $originalResource;
 
        /**
-        * @param \TYPO3\CMS\Core\Resource\ResourceInterface $object
+        * @param \TYPO3\CMS\Core\Resource\ResourceInterface $originalResource
         */
-       public function setObject(\TYPO3\CMS\Core\Resource\ResourceInterface $object) {
-               $this->object = $object;
+       public function setOriginalResource(\TYPO3\CMS\Core\Resource\ResourceInterface $originalResource) {
+               $this->originalResource = $originalResource;
        }
 
        /**
         * @return \TYPO3\CMS\Core\Resource\ResourceInterface|\TYPO3\CMS\Core\Resource\Folder|\TYPO3\CMS\Core\Resource\AbstractFile
         */
-       public function getObject() {
-               return $this->object;
+       public function getOriginalResource() {
+               return $this->originalResource;
        }
 }
 
-?>
\ No newline at end of file
+?>
index 56cbf99..623adc3 100644 (file)
@@ -69,13 +69,13 @@ abstract class AbstractFileFolderConverter extends \TYPO3\CMS\Extbase\Property\T
         * @api
         */
        public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration = NULL) {
-               $object = $this->getObject($source);
+               $object = $this->getOriginalResource($source);
                if (empty($this->expectedObjectType) || !$object instanceof $this->expectedObjectType) {
                        throw new \TYPO3\CMS\Extbase\Property\Exception('Expected object of type "' . $this->expectedObjectType . '" but got ' . get_class($object), 1342895975);
                }
                /** @var $subject \TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder */
                $subject = $this->objectManager->create($targetType);
-               $subject->setObject($object);
+               $subject->setOriginalResource($object);
                return $subject;
        }
 
@@ -83,7 +83,7 @@ abstract class AbstractFileFolderConverter extends \TYPO3\CMS\Extbase\Property\T
         * @param string|integer $source
         * @return \TYPO3\CMS\Core\Resource\ResourceInterface
         */
-       abstract protected function getObject($source);
+       abstract protected function getOriginalResource($source);
 }
 
-?>
\ No newline at end of file
+?>
index 5802dc7..17661af 100644 (file)
@@ -53,9 +53,9 @@ class FileConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\AbstractFi
         * @param string|integer $source
         * @return \TYPO3\CMS\Core\Resource\FileInterface|\TYPO3\CMS\Core\Resource\Folder
         */
-       protected function getObject($source) {
+       protected function getOriginalResource($source) {
                return $this->fileFactory->retrieveFileOrFolderObject($source);
        }
 }
 
-?>
\ No newline at end of file
+?>
index a0c21b8..6787845 100644 (file)
@@ -53,9 +53,9 @@ class FileReferenceConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\A
         * @param integer $source
         * @return \TYPO3\CMS\Core\Resource\FileReference
         */
-       protected function getObject($source) {
+       protected function getOriginalResource($source) {
                return $this->fileFactory->getFileReferenceObject($source);
        }
 }
 
-?>
\ No newline at end of file
+?>
index e73a2f1..d23a43e 100644 (file)
@@ -53,9 +53,9 @@ class FolderConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstract
         * @param string $source
         * @return \TYPO3\CMS\Core\Resource\Folder
         */
-       protected function getObject($source) {
+       protected function getOriginalResource($source) {
                return $this->fileFactory->getFolderObjectFromCombinedIdentifier($source);
        }
 }
 
-?>
\ No newline at end of file
+?>
index 827754d..0106135 100644 (file)
@@ -74,8 +74,8 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                /** @var $fixture \TYPO3\CMS\Extbase\Tests\Functional\Domain\Model\Fixture\FileContext */
                $fixture = $this->propertyMapper->convert($data, 'TYPO3\\CMS\\Extbase\\Tests\\Functional\\Domain\\Model\\Fixture\\FileContext', $this->propertyMapperConfiguration);
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Domain\\Model\\File', $fixture->getFile());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFile()->getObject());
-               $this->assertEquals(1, $fixture->getFile()->getObject()->getUid());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFile()->getOriginalResource());
+               $this->assertEquals(1, $fixture->getFile()->getOriginalResource()->getUid());
        }
 
        /**
@@ -93,9 +93,9 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', $fixture->getFiles());
                $this->assertEquals(2, $fixture->getFiles()->count());
                $fixture->getFiles()->rewind();
-               $this->assertEquals(1, $fixture->getFiles()->current()->getObject()->getUid());
+               $this->assertEquals(1, $fixture->getFiles()->current()->getOriginalResource()->getUid());
                $fixture->getFiles()->next();
-               $this->assertEquals(2, $fixture->getFiles()->current()->getObject()->getUid());
+               $this->assertEquals(2, $fixture->getFiles()->current()->getOriginalResource()->getUid());
        }
 
        /**
@@ -108,9 +108,9 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                /** @var $fixture \TYPO3\CMS\Extbase\Tests\Functional\Domain\Model\Fixture\FileContext */
                $fixture = $this->propertyMapper->convert($data, 'TYPO3\\CMS\\Extbase\\Tests\\Functional\\Domain\\Model\\Fixture\\FileContext', $this->propertyMapperConfiguration);
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference', $fixture->getFileReference());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReference()->getObject());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReference()->getObject()->getOriginalFile());
-               $this->assertEquals(1, $fixture->getFileReference()->getObject()->getOriginalFile()->getUid());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReference()->getOriginalResource());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReference()->getOriginalResource()->getOriginalFile());
+               $this->assertEquals(1, $fixture->getFileReference()->getOriginalResource()->getOriginalFile()->getUid());
        }
 
        /**
@@ -128,13 +128,13 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', $fixture->getFileReferences());
                $this->assertEquals(2, $fixture->getFileReferences()->count());
                $fixture->getFileReferences()->rewind();
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReferences()->current()->getObject());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReferences()->current()->getObject()->getOriginalFile());
-               $this->assertEquals(1, $fixture->getFileReferences()->current()->getObject()->getOriginalFile()->getUid());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReferences()->current()->getOriginalResource());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReferences()->current()->getOriginalResource()->getOriginalFile());
+               $this->assertEquals(1, $fixture->getFileReferences()->current()->getOriginalResource()->getOriginalFile()->getUid());
                $fixture->getFileReferences()->next();
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReferences()->current()->getObject());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReferences()->current()->getObject()->getOriginalFile());
-               $this->assertEquals(2, $fixture->getFileReferences()->current()->getObject()->getOriginalFile()->getUid());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\FileReference', $fixture->getFileReferences()->current()->getOriginalResource());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\File', $fixture->getFileReferences()->current()->getOriginalResource()->getOriginalFile());
+               $this->assertEquals(2, $fixture->getFileReferences()->current()->getOriginalResource()->getOriginalFile()->getUid());
        }
 
        /**
@@ -151,8 +151,8 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                /** @var $fixture \TYPO3\CMS\Extbase\Tests\Functional\Domain\Model\Fixture\FileContext */
                $fixture = $this->propertyMapper->convert($data, 'TYPO3\\CMS\\Extbase\\Tests\\Functional\\Domain\\Model\\Fixture\\FileContext', $this->propertyMapperConfiguration);
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Domain\\Model\\Folder', $fixture->getFolder());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolder()->getObject());
-               $this->assertEquals('/', $fixture->getFolder()->getObject()->getIdentifier());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolder()->getOriginalResource());
+               $this->assertEquals('/', $fixture->getFolder()->getOriginalResource()->getIdentifier());
        }
 
        /**
@@ -175,12 +175,12 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
                $this->assertEquals(2, $fixture->getFolders()->count());
                $fixture->getFolders()->rewind();
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Domain\\Model\\Folder', $fixture->getFolders()->current());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolders()->current()->getObject());
-               $this->assertEquals('/', $fixture->getFolders()->current()->getObject()->getIdentifier());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolders()->current()->getOriginalResource());
+               $this->assertEquals('/', $fixture->getFolders()->current()->getOriginalResource()->getIdentifier());
                $fixture->getFolders()->next();
                $this->assertInstanceOf('TYPO3\\CMS\\Extbase\\Domain\\Model\\Folder', $fixture->getFolders()->current());
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolders()->current()->getObject());
-               $this->assertEquals('/', $fixture->getFolders()->current()->getObject()->getIdentifier());
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Resource\\Folder', $fixture->getFolders()->current()->getOriginalResource());
+               $this->assertEquals('/', $fixture->getFolders()->current()->getOriginalResource()->getIdentifier());
        }
 
        /**
@@ -244,4 +244,4 @@ class FileContextTest extends \Tx_Extbase_Tests_Functional_BaseTestCase {
        }
 }
 
-?>
\ No newline at end of file
+?>