[TASK] Turn todos into @todo to find them easier
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / Generic / BackendInterface.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Persistence\Generic;
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 * A persistence backend interface
18 */
19 interface BackendInterface {
20
21 /**
22 * Set a PersistenceManager instance.
23 *
24 * @param \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager
25 * @return void
26 */
27 public function setPersistenceManager(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager);
28
29 /**
30 * Sets the aggregate root objects
31 *
32 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $objects
33 * @return void
34 */
35 public function setAggregateRootObjects(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $objects);
36
37 /**
38 * Sets the deleted entities
39 *
40 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $entities
41 * @return void
42 * @api
43 */
44 public function setDeletedEntities(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $entities);
45
46 /**
47 * Sets the changed objects
48 *
49 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $entities
50 * @return void
51 */
52 public function setChangedEntities(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $entities);
53
54 /**
55 * Commits the current persistence session
56 *
57 * @return void
58 */
59 public function commit();
60
61 // @todo refactor towards being closer to the Flow backend interface again
62
63 /**
64 * Returns the (internal) identifier for the object, if it is known to the
65 * backend. Otherwise NULL is returned.
66 *
67 * @param object $object
68 * @return string The identifier for the object if it is known, or NULL
69 */
70 public function getIdentifierByObject($object);
71
72 /**
73 * Returns the object with the (internal) identifier, if it is known to the
74 * backend. Otherwise NULL is returned.
75 *
76 * @param string $identifier
77 * @param string $className
78 * @return object The object for the identifier if it is known, or NULL
79 */
80 public function getObjectByIdentifier($identifier, $className);
81
82 /**
83 * Checks if the given object has ever been persisted.
84 *
85 * @param object $object The object to check
86 * @return bool TRUE if the object is new, FALSE if the object exists in the repository
87 */
88 public function isNewObject($object);
89
90 /**
91 * Returns the number of records matching the query.
92 *
93 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
94 * @return int
95 * @api
96 */
97 public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
98
99 /**
100 * Returns the object data matching the $query.
101 *
102 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
103 * @return array
104 * @api
105 */
106 public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
107 }