-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
RepositoryInterface.php
125 lines (113 loc) · 3.06 KB
/
RepositoryInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
namespace Neos\Flow\Persistence;
/*
* This file is part of the Neos.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
/**
* Contract for a repository
*
* @api
*/
interface RepositoryInterface
{
/**
* Returns the object type this repository is managing.
*
* @return string
* @api
*/
public function getEntityClassName(): string;
/**
* Adds an object to this repository.
*
* @param object $object The object to add
* @return void
* @api
*/
public function add($object): void;
/**
* Removes an object from this repository.
*
* @param object $object The object to remove
* @return void
* @api
*/
public function remove($object): void;
/**
* Returns all objects of this repository.
*
* @return QueryResultInterface The query result
* @api
*/
public function findAll(): QueryResultInterface;
/**
* Finds an object matching the given identifier.
*
* @param mixed $identifier The identifier of the object to find
* @return object|null The matching object if found, otherwise NULL
* @api
*/
public function findByIdentifier($identifier);
/**
* Returns a query for objects of this repository
*
* @return QueryInterface
* @api
*/
public function createQuery(): QueryInterface;
/**
* Counts all objects of this repository
*
* @return integer
* @api
*/
public function countAll(): int;
/**
* Removes all objects of this repository as if remove() was called for
* all of them.
*
* @return void
* @api
*/
public function removeAll(): void;
/**
* Sets the property names to order results by. Expected like this:
* array(
* 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING,
* 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING
* )
*
* @param array $defaultOrderings The property names to order by by default
* @return void
* @api
*/
public function setDefaultOrderings(array $defaultOrderings): void;
/**
* Schedules a modified object for persistence.
*
* @param object $object The modified object
* @return void
* @api
*/
public function update($object): void;
/**
* Magic call method for repository methods.
*
* Provides three methods
* - findBy<PropertyName>($value, $caseSensitive = true, $cacheResult = false)
* - findOneBy<PropertyName>($value, $caseSensitive = true, $cacheResult = false)
* - countBy<PropertyName>($value, $caseSensitive = true)
*
* @param string $method Name of the method
* @param array $arguments The arguments
* @return mixed The result of the repository method
* @api
*/
public function __call($method, $arguments);
}