TYPO3 API  SVNRelease
Session.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00024 
00025 /**
00026  * The persistence session - acts as a Unit of Work for Extbase persistence framework.
00027  *
00028  * @package Extbase
00029  * @subpackage Persistence
00030  * @version $ID:$
00031  */
00032 class Tx_Extbase_Persistence_Session implements t3lib_singleton {
00033 
00034     /**
00035      * Objects which were reconstituted. The relevant objects are registered by
00036      * the Tx_Extbase_Persistence_Mapper_DataMapper.
00037      *
00038      * @var Tx_Extbase_Persistence_ObjectStorage
00039      */
00040     protected $reconstitutedObjects;
00041 
00042     /**
00043      * Constructs a new Session
00044      *
00045      */
00046     public function __construct() {
00047         $this->reconstitutedObjects = new Tx_Extbase_Persistence_ObjectStorage();
00048     }
00049 
00050     /**
00051      * Registers a reconstituted object
00052      *
00053      * @param object $object
00054      * @return void
00055      */
00056     public function registerReconstitutedObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
00057         $this->reconstitutedObjects->attach($object);
00058     }
00059 
00060     /**
00061      * Unregisters a reconstituted object
00062      *
00063      * @param Tx_Extbase_DomainObject_DomainObjectInterface $object
00064      * @return void
00065      */
00066     public function unregisterReconstitutedObject(Tx_Extbase_DomainObject_DomainObjectInterface $object) {
00067         $this->reconstitutedObjects->detach($object);
00068     }
00069 
00070     /**
00071      * Returns all objects which have been registered as reconstituted objects
00072      *
00073      * @param string $objectClassName The class name of objects to be returned
00074      * @return array All reconstituted objects
00075      */
00076     public function getReconstitutedObjects() {
00077         return $this->reconstitutedObjects;
00078     }
00079 
00080 }
00081 ?>