[TASK] Drop some wrong deprecation annotations in extbase
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / PersistenceManagerInterface.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Persistence;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * The Extbase Persistence Manager interface
19 */
20 interface PersistenceManagerInterface
21 {
22 /**
23 * Commits new objects and changes to objects in the current persistence
24 * session into the backend
25 */
26 public function persistAll();
27
28 /**
29 * Clears the in-memory state of the persistence.
30 *
31 * Managed instances become detached, any fetches will
32 * return data directly from the persistence "backend".
33 */
34 public function clearState();
35
36 /**
37 * Checks if the given object has ever been persisted.
38 *
39 * @param object $object The object to check
40 * @return bool TRUE if the object is new, FALSE if the object exists in the repository
41 */
42 public function isNewObject($object);
43
44 // @todo realign with Flow PersistenceManager again
45
46 /**
47 * Returns the (internal) identifier for the object, if it is known to the
48 * backend. Otherwise NULL is returned.
49 *
50 * Note: this returns an identifier even if the object has not been
51 * persisted in case of AOP-managed entities. Use isNewObject() if you need
52 * to distinguish those cases.
53 *
54 * @param object $object
55 * @return mixed The identifier for the object if it is known, or NULL
56 */
57 public function getIdentifierByObject($object);
58
59 /**
60 * Returns the object with the (internal) identifier, if it is known to the
61 * backend. Otherwise NULL is returned.
62 *
63 * @param mixed $identifier
64 * @param string $objectType
65 * @param bool $useLazyLoading Set to TRUE if you want to use lazy loading for this object
66 * @return object The object for the identifier if it is known, or NULL
67 */
68 public function getObjectByIdentifier($identifier, $objectType = null, $useLazyLoading = false);
69
70 /**
71 * Returns the number of records matching the query.
72 *
73 * @param QueryInterface $query
74 * @return int
75 */
76 public function getObjectCountByQuery(QueryInterface $query);
77
78 /**
79 * Returns the object data matching the $query.
80 *
81 * @param QueryInterface $query
82 * @return array
83 */
84 public function getObjectDataByQuery(QueryInterface $query);
85
86 /**
87 * Registers a repository
88 *
89 * @param string $className The class name of the repository to be registered
90 */
91 public function registerRepositoryClassName($className);
92
93 /**
94 * Adds an object to the persistence.
95 *
96 * @param object $object The object to add
97 */
98 public function add($object);
99
100 /**
101 * Removes an object to the persistence.
102 *
103 * @param object $object The object to remove
104 */
105 public function remove($object);
106
107 /**
108 * Update an object in the persistence.
109 *
110 * @param object $object The modified object
111 * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
112 */
113 public function update($object);
114
115 /**
116 * Injects the Extbase settings, called by Extbase.
117 *
118 * @param array $settings
119 */
120 public function injectSettings(array $settings);
121
122 /**
123 * Converts the given object into an array containing the identity of the domain object.
124 *
125 * @param object $object The object to be converted
126 * @return array The identity array in the format array('__identity' => '...')
127 * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException if the given object is not known to the Persistence Manager
128 */
129 public function convertObjectToIdentityArray($object);
130
131 /**
132 * Recursively iterates through the given array and turns objects
133 * into arrays containing the identity of the domain object.
134 *
135 * @param array $array The array to be iterated over
136 * @return array The modified array without objects
137 * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException if array contains objects that are not known to the Persistence Manager
138 * @see convertObjectToIdentityArray()
139 */
140 public function convertObjectsToIdentityArrays(array $array);
141
142 /**
143 * Return a query object for the given type.
144 *
145 * @param string $type
146 * @return QueryInterface
147 */
148 public function createQueryForType($type);
149 }