[TASK] Remove unused reconstitutedEntitiesData from extbase Session 31/58331/3
authorŁukasz Uznański <l.uznanski@macopedia.pl>
Wed, 19 Sep 2018 09:27:22 +0000 (11:27 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 19 Sep 2018 16:52:17 +0000 (18:52 +0200)
This property is not used

Releases: master
Resolves: #86309
Change-Id: I38cba224bd765304040a6dfaea4546361fe8ecc1
Reviewed-on: https://review.typo3.org/58331
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/extbase/Classes/Persistence/Generic/Session.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php

index ab0351b..bf9bf71 100644 (file)
@@ -29,15 +29,6 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface
     protected $reconstitutedEntities;
 
     /**
-     * Reconstituted entity data (effectively their clean state)
-     * Currently unused in Extbase
-     * @todo make use of it in Extbase
-     *
-     * @var array
-     */
-    protected $reconstitutedEntitiesData = [];
-
-    /**
      * @var ObjectStorage
      */
     protected $objectMap;
@@ -63,12 +54,10 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface
      * "Documentation/PersistenceFramework object data format.txt"
      *
      * @param object $entity
-     * @param array $entityData
      */
-    public function registerReconstitutedEntity($entity, array $entityData = [])
+    public function registerReconstitutedEntity($entity)
     {
         $this->reconstitutedEntities->attach($entity);
-        $this->reconstitutedEntitiesData[$entityData['identifier']] = $entityData;
     }
 
     /**
@@ -92,7 +81,6 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface
     {
         if ($this->reconstitutedEntities->contains($entity)) {
             $this->reconstitutedEntities->detach($entity);
-            unset($this->reconstitutedEntitiesData[$this->getIdentifierByObject($entity)]);
         }
     }
 
@@ -206,6 +194,5 @@ class Session implements \TYPO3\CMS\Core\SingletonInterface
         $this->identifierMap = [];
         $this->objectMap = new ObjectStorage();
         $this->reconstitutedEntities = new ObjectStorage();
-        $this->reconstitutedEntitiesData = [];
     }
 }
index 55cc8e1..e9d2afe 100644 (file)
@@ -28,7 +28,7 @@ class SessionTest extends UnitTestCase
     {
         $someObject = new \ArrayObject([]);
         $session = new Session();
-        $session->registerReconstitutedEntity($someObject, ['identifier' => 'fakeUuid']);
+        $session->registerReconstitutedEntity($someObject);
 
         $ReconstitutedEntities = $session->getReconstitutedEntities();
         $this->assertTrue($ReconstitutedEntities->contains($someObject));
@@ -42,7 +42,7 @@ class SessionTest extends UnitTestCase
         $someObject = new \ArrayObject([]);
         $session = new Session();
         $session->registerObject($someObject, 'fakeUuid');
-        $session->registerReconstitutedEntity($someObject, ['identifier' => 'fakeUuid']);
+        $session->registerReconstitutedEntity($someObject);
         $session->unregisterReconstitutedEntity($someObject);
 
         $ReconstitutedEntities = $session->getReconstitutedEntities();
@@ -140,7 +140,7 @@ class SessionTest extends UnitTestCase
     {
         $persistenceSession = new Session();
         $entity = $this->createMock(AbstractEntity::class);
-        $persistenceSession->registerReconstitutedEntity($entity, ['identifier' => 'fakeUuid']);
+        $persistenceSession->registerReconstitutedEntity($entity);
         $reconstitutedObjects = $persistenceSession->getReconstitutedEntities();
         $this->assertTrue($reconstitutedObjects->contains($entity), 'The object was not registered as reconstituted.');
     }
@@ -152,7 +152,7 @@ class SessionTest extends UnitTestCase
     {
         $persistenceSession = new Session();
         $entity = $this->createMock(AbstractEntity::class);
-        $persistenceSession->registerReconstitutedEntity($entity, ['identifier' => 'fakeUuid']);
+        $persistenceSession->registerReconstitutedEntity($entity);
         $persistenceSession->unregisterReconstitutedEntity($entity);
         $reconstitutedObjects = $persistenceSession->getReconstitutedEntities();
         $this->assertEquals(0, count($reconstitutedObjects), 'The reconstituted objects storage was not empty.');