Add Extbase 1.0.1 to TYPO3core. Do NOT make changes inside! See misc/core_svn_rules...
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / BackendInterface.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * A persistence backend interface
30 *
31 * @package Extbase
32 * @subpackage Persistence
33 * @version $Id: BackendInterface.php 1729 2009-11-25 21:37:20Z stucki $
34 */
35 interface Tx_Extbase_Persistence_BackendInterface {
36
37 /**
38 * Sets the aggregate root objects
39 *
40 * @param Tx_Extbase_Persistence_ObjectStorage $objects
41 * @return void
42 */
43 public function setAggregateRootObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
44
45 /**
46 * Sets the deleted objects
47 *
48 * @param Tx_Extbase_Persistence_ObjectStorage $objects
49 * @return void
50 */
51 public function setDeletedObjects(Tx_Extbase_Persistence_ObjectStorage $objects);
52
53 /**
54 * Commits the current persistence session
55 *
56 * @return void
57 */
58 public function commit();
59
60 /**
61 * Returns the (internal) identifier for the object, if it is known to the
62 * backend. Otherwise NULL is returned.
63 *
64 * @param object $object
65 * @return string The identifier for the object if it is known, or NULL
66 */
67 public function getIdentifierByObject($object);
68
69 /**
70 * Returns the object with the (internal) identifier, if it is known to the
71 * backend. Otherwise NULL is returned.
72 *
73 * @param string $identifier
74 * @param string $className
75 * @return object The object for the identifier if it is known, or NULL
76 */
77 public function getObjectByIdentifier($identifier, $className);
78
79 /**
80 * Checks if the given object has ever been persisted.
81 *
82 * @param object $object The object to check
83 * @return boolean TRUE if the object is new, FALSE if the object exists in the repository
84 */
85 public function isNewObject($object);
86
87 /**
88 * Replaces the given object by the second object.
89 *
90 * This method will unregister the existing object at the identity map and
91 * register the new object instead. The existing object must therefore
92 * already be registered at the identity map which is the case for all
93 * reconstituted objects.
94 *
95 * The new object will be identified by the uuid which formerly belonged
96 * to the existing object. The existing object looses its uuid.
97 *
98 * @param object $existingObject The existing object
99 * @param object $newObject The new object
100 * @return void
101 */
102 public function replaceObject($existingObject, $newObject);
103 }
104 ?>