[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / RepositoryInterface.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 * Contract for a repository
18 *
19 * @api
20 */
21 interface RepositoryInterface {
22
23 /**
24 * Adds an object to this repository.
25 *
26 * @param object $object The object to add
27 * @return void
28 * @api
29 */
30 public function add($object);
31
32 /**
33 * Removes an object from this repository.
34 *
35 * @param object $object The object to remove
36 * @return void
37 * @api
38 */
39 public function remove($object);
40
41 /**
42 * Replaces an existing object with the same identifier by the given object
43 *
44 * @param object $modifiedObject The modified object
45 * @api
46 */
47 public function update($modifiedObject);
48
49 /**
50 * Returns all objects of this repository.
51 *
52 * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result
53 * @api
54 */
55 public function findAll();
56
57 /**
58 * Returns the total number objects of this repository.
59 *
60 * @return integer The object count
61 * @api
62 */
63 public function countAll();
64
65 /**
66 * Removes all objects of this repository as if remove() was called for
67 * all of them.
68 *
69 * @return void
70 * @api
71 */
72 public function removeAll();
73
74 /**
75 * Finds an object matching the given identifier.
76 *
77 * @param integer $uid The identifier of the object to find
78 * @return object The matching object if found, otherwise NULL
79 * @api
80 */
81 public function findByUid($uid);
82
83 /**
84 * Finds an object matching the given identifier.
85 *
86 * @param mixed $identifier The identifier of the object to find
87 * @return object The matching object if found, otherwise NULL
88 * @api
89 */
90 public function findByIdentifier($identifier);
91
92 /**
93 * Sets the property names to order the result by per default.
94 * Expected like this:
95 * array(
96 * 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
97 * 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
98 * )
99 *
100 * @param array $defaultOrderings The property names to order by
101 * @return void
102 * @api
103 */
104 public function setDefaultOrderings(array $defaultOrderings);
105
106 /**
107 * Sets the default query settings to be used in this repository
108 *
109 * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $defaultQuerySettings The query settings to be used by default
110 * @return void
111 * @api
112 */
113 public function setDefaultQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $defaultQuerySettings);
114
115 /**
116 * Returns a query for objects of this repository
117 *
118 * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
119 * @api
120 */
121 public function createQuery();
122 }