[TASK] Remove duplicate files in persistence
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 30 Oct 2012 20:08:51 +0000 (21:08 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 30 Oct 2012 22:03:29 +0000 (23:03 +0100)
The namespaceing script messed up the persistence
of Extbase. So duplicate files have to be removed.

For keeping git history, Manager.php will be
renamed to PersistenceManager.php in an additional commit.

Fixes: #42504
Releases: 6.0
Change-Id: I9f26e8f8ced0a992e88b455c2d823401d993d9e9
Reviewed-on: http://review.typo3.org/16034
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extbase/Classes/Persistence/Generic/Manager.php
typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Generic/ObjectMonitoringInterface.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php [deleted file]
typo3/sysext/extbase/ext_autoload.php

index 6640797..e649e20 100644 (file)
@@ -31,7 +31,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
  *
  * @api
  */
-class Manager implements \TYPO3\CMS\Extbase\Persistence\Generic\ManagerInterface, \TYPO3\CMS\Core\SingletonInterface {
+class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface, \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * @var \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
@@ -44,7 +44,7 @@ class Manager implements \TYPO3\CMS\Extbase\Persistence\Generic\ManagerInterface
        protected $session;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterfaceException
+        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
         */
        protected $objectManager;
 
@@ -78,10 +78,10 @@ class Manager implements \TYPO3\CMS\Extbase\Persistence\Generic\ManagerInterface
        /**
         * Injects the object manager
         *
-        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterfaceException $objectManager
+        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
         * @return void
         */
-       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterfaceException $objectManager) {
+       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
                $this->objectManager = $objectManager;
        }
 
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/ManagerInterface.php
deleted file mode 100644 (file)
index 9464a68..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                          *
- *                                                                        *
- * This class is a backport of the corresponding class of FLOW3.          *
- * All credits go to the v5 team.                                         *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-/**
- * The Extbase Persistence Manager interface
- *
- * @deprecated since Extbase 6.0, will be removed in Extbase 7.0
- */
-interface ManagerInterface extends \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
-{
-       /**
-        * Returns the current persistence session
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\Generic\Session
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 7.0
-        */
-       public function getSession();
-
-       /**
-        * Returns the persistence backend
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 7.0
-        */
-       public function getBackend();
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/ObjectMonitoringInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/ObjectMonitoringInterface.php
deleted file mode 100644 (file)
index cfb0718..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * An interface how to monitor changes on an object and its properties. All domain objects which should be persisted need to implement the below interface.
- *
- * @see Tx_Extbase_DomainObject_AbstractEntity
- * @see Tx_Extbase_DomainObject_AbstractValueObject
- */
-interface ObjectMonitoringInterface
-{
-       /**
-        * Register an object's clean state, e.g. after it has been reconstituted
-        * from the database
-        *
-        * @return void
-        */
-       public function _memorizeCleanState();
-
-       /**
-        * Returns TRUE if the properties were modified after reconstitution
-        *
-        * @return boolean
-        */
-       public function _isDirty();
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php b/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php
deleted file mode 100644 (file)
index e649e20..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
- *  All rights reserved
- *
- *  This class is a backport of the corresponding class of FLOW3.
- *  All credits go to the v5 team.
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * The Extbase Persistence Manager
- *
- * @api
- */
-class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface, \TYPO3\CMS\Core\SingletonInterface {
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
-        */
-       protected $backend;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Persistence\Generic\Session
-        */
-       protected $session;
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-        */
-       protected $objectManager;
-
-       /**
-        * This is an array of registered repository class names.
-        *
-        * @var array
-        */
-       protected $repositoryClassNames = array();
-
-       /**
-        * Injects the Persistence Backend
-        *
-        * @param \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface $backend The persistence backend
-        * @return void
-        */
-       public function injectBackend(\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface $backend) {
-               $this->backend = $backend;
-       }
-
-       /**
-        * Injects the Persistence Session
-        *
-        * @param \TYPO3\CMS\Extbase\Persistence\Generic\Session $session The persistence session
-        * @return void
-        */
-       public function injectSession(\TYPO3\CMS\Extbase\Persistence\Generic\Session $session) {
-               $this->session = $session;
-       }
-
-       /**
-        * Injects the object manager
-        *
-        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-        * @return void
-        */
-       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
-               $this->objectManager = $objectManager;
-       }
-
-       /**
-        * Returns the current persistence session
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\Generic\Session
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
-        */
-       public function getSession() {
-               return $this->session;
-       }
-
-       /**
-        * Returns the persistence backend
-        *
-        * @return \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
-        * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
-        */
-       public function getBackend() {
-               return $this->backend;
-       }
-
-       /**
-        * Registers a repository
-        *
-        * @param string $className The class name of the repository to be reigistered
-        * @return void
-        */
-       public function registerRepositoryClassName($className) {
-               $this->repositoryClassNames[] = $className;
-       }
-
-       /**
-        * Returns the number of records matching the query.
-        *
-        * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
-        * @return integer
-        * @api
-        */
-       public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
-               return $this->backend->getObjectCountByQuery($query);
-       }
-
-       /**
-        * Returns the object data matching the $query.
-        *
-        * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
-        * @return array
-        * @api
-        */
-       public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
-               return $this->backend->getObjectDataByQuery($query);
-       }
-
-       /**
-        * Returns the (internal) identifier for the object, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * Note: this returns an identifier even if the object has not been
-        * persisted in case of AOP-managed entities. Use isNewObject() if you need
-        * to distinguish those cases.
-        *
-        * @param object $object
-        * @return mixed The identifier for the object if it is known, or NULL
-        * @api
-        */
-       public function getIdentifierByObject($object) {
-               return $this->backend->getIdentifierByObject($object);
-       }
-
-       /**
-        * Returns the object with the (internal) identifier, if it is known to the
-        * backend. Otherwise NULL is returned.
-        *
-        * @param mixed $identifier
-        * @param string $objectType
-        * @return object The object for the identifier if it is known, or NULL
-        * @api
-        */
-       public function getObjectByIdentifier($identifier, $objectType) {
-               return $this->backend->getObjectByIdentifier($identifier, $objectType);
-       }
-
-       /**
-        * Commits new objects and changes to objects in the current persistence
-        * session into the backend
-        *
-        * @return void
-        * @api
-        */
-       public function persistAll() {
-               $aggregateRootObjects = new \TYPO3\CMS\Extbase\Persistence\Generic\ObjectStorage();
-               $removedObjects = new \TYPO3\CMS\Extbase\Persistence\Generic\ObjectStorage();
-               // fetch and inspect objects from all known repositories
-               foreach ($this->repositoryClassNames as $repositoryClassName) {
-                       $repository = $this->objectManager->get($repositoryClassName);
-                       $aggregateRootObjects->addAll($repository->getAddedObjects());
-                       $removedObjects->addAll($repository->getRemovedObjects());
-               }
-               foreach ($this->session->getReconstitutedObjects() as $reconstitutedObject) {
-                       if (class_exists(str_replace('_Model_', '_Repository_', get_class($reconstitutedObject)) . 'Repository')) {
-                               $aggregateRootObjects->attach($reconstitutedObject);
-                       }
-               }
-               // hand in only aggregate roots, leaving handling of subobjects to
-               // the underlying storage layer
-               $this->backend->setAggregateRootObjects($aggregateRootObjects);
-               $this->backend->setDeletedObjects($removedObjects);
-               $this->backend->commit();
-               // this needs to unregister more than just those, as at least some of
-               // the subobjects are supposed to go away as well...
-               // OTOH those do no harm, changes to the unused ones should not happen,
-               // so all they do is eat some memory.
-               foreach ($removedObjects as $removedObject) {
-                       $this->session->unregisterReconstitutedObject($removedObject);
-               }
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 8c09153..79a2902 100644 (file)
@@ -23,6 +23,7 @@ return array(
        'tx_extbase_persistence_lazyobjectstorage' => $extensionClassesPath . 'Persistence/Generic/LazyObjectStorage.php',
        'tx_extbase_persistence_loadingstrategyinterface' => $extensionClassesPath . 'Persistence/Generic/LoadingStrategyInterface.php',
        'tx_extbase_persistence_manager' => $extensionClassesPath . 'Persistence/Generic/Manager.php',
+       'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager' => $extensionClassesPath . 'Persistence/Generic/Manager.php',
        'tx_extbase_persistence_managerinterface' => $extensionClassesPath . 'Persistence/Generic/ManagerInterface.php',
        'tx_extbase_persistence_mapper_columnmap' => $extensionClassesPath . 'Persistence/Generic/Mapper/ColumnMap.php',
        'tx_extbase_persistence_mapper_datamap' => $extensionClassesPath . 'Persistence/Generic/Mapper/DataMap.php',