2 /***************************************************************
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
26 * The persistence session - acts as a Unit of Work for Extbase persistence framework.
29 * @subpackage Persistence
32 class Tx_Extbase_Persistence_Session
implements t3lib_singleton
{
35 * Objects which were reconstituted. The relevant objects are registered by
36 * the Tx_Extbase_Persistence_Mapper_DataMapper.
38 * @var Tx_Extbase_Persistence_ObjectStorage
40 protected $reconstitutedObjects;
43 * Constructs a new Session
46 public function __construct() {
47 $this->reconstitutedObjects
= new Tx_Extbase_Persistence_ObjectStorage();
51 * Registers a reconstituted object
53 * @param object $object
56 public function registerReconstitutedObject(Tx_Extbase_DomainObject_DomainObjectInterface
$object) {
57 $this->reconstitutedObjects
->attach($object);
61 * Unregisters a reconstituted object
63 * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
66 public function unregisterReconstitutedObject(Tx_Extbase_DomainObject_DomainObjectInterface
$object) {
67 $this->reconstitutedObjects
->detach($object);
71 * Returns all objects which have been registered as reconstituted objects
73 * @param string $objectClassName The class name of objects to be returned
74 * @return array All reconstituted objects
76 public function getReconstitutedObjects() {
77 return $this->reconstitutedObjects
;