1 | <?php |
||
17 | class Definition |
||
18 | { |
||
19 | /** |
||
20 | * @var ClassName |
||
21 | */ |
||
22 | private $className; |
||
23 | |||
24 | /** |
||
25 | * @var Identity |
||
26 | */ |
||
27 | private $idDefinition; |
||
28 | |||
29 | /** |
||
30 | * @var NewCommandHandler|null |
||
31 | */ |
||
32 | private $newCommandHandler; |
||
33 | |||
34 | /** |
||
35 | * @var EditCommandHandler|null |
||
36 | */ |
||
37 | private $editCommandHandler; |
||
38 | |||
39 | /** |
||
40 | * @var RemoveCommandHandler|null |
||
41 | */ |
||
42 | private $removeCommandHandler; |
||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | private $observedProperties; |
||
48 | |||
49 | /** |
||
50 | * @var IdentificationStrategy |
||
51 | */ |
||
52 | private $identificationStrategy; |
||
53 | |||
54 | /** |
||
55 | * @param ClassName $className |
||
56 | * @param Identity $idDefinition |
||
57 | * @param IdentificationStrategy $identificationStrategy |
||
58 | */ |
||
59 | public function __construct(ClassName $className, Identity $idDefinition, IdentificationStrategy $identificationStrategy = null) |
||
66 | |||
67 | /** |
||
68 | * @param Property[] $properties |
||
69 | * @throws InvalidArgumentException |
||
70 | * @throws NotExistingPropertyException |
||
71 | * |
||
72 | * @api |
||
73 | */ |
||
74 | public function setObserved(array $properties) |
||
84 | |||
85 | /** |
||
86 | * @param Property $property |
||
87 | * @throws InvalidArgumentException |
||
88 | * @throws NotExistingPropertyException |
||
89 | * |
||
90 | * @api |
||
91 | */ |
||
92 | public function addToObserved(Property $property) |
||
98 | |||
99 | /** |
||
100 | * @return Property[]|array |
||
101 | * |
||
102 | * @api |
||
103 | */ |
||
104 | public function getObservedProperties() |
||
108 | |||
109 | /** |
||
110 | * @return ClassName |
||
111 | * |
||
112 | * @api |
||
113 | */ |
||
114 | public function getClassName() |
||
118 | |||
119 | /** |
||
120 | * @return Identity |
||
121 | * |
||
122 | * @api |
||
123 | */ |
||
124 | public function getIdDefinition() |
||
128 | |||
129 | /** |
||
130 | * @param $entity |
||
131 | * @return bool |
||
132 | * |
||
133 | * @api |
||
134 | */ |
||
135 | public function fitsFor($entity) |
||
139 | |||
140 | /** |
||
141 | * @param NewCommandHandler $commandHandler |
||
142 | * |
||
143 | * @api |
||
144 | */ |
||
145 | public function setNewCommandHandler(NewCommandHandler $commandHandler) |
||
149 | |||
150 | /** |
||
151 | * @return bool |
||
152 | * |
||
153 | * @api |
||
154 | */ |
||
155 | public function hasNewCommandHandler() |
||
159 | |||
160 | /** |
||
161 | * @return NewCommandHandler|null |
||
162 | * |
||
163 | * @api |
||
164 | */ |
||
165 | public function getNewCommandHandler() |
||
169 | |||
170 | /** |
||
171 | * @param EditCommandHandler $commandHandler |
||
172 | * |
||
173 | * @api |
||
174 | */ |
||
175 | public function setEditCommandHandler(EditCommandHandler $commandHandler) |
||
179 | |||
180 | /** |
||
181 | * @return bool |
||
182 | * |
||
183 | * @api |
||
184 | */ |
||
185 | public function hasEditCommandHandler() |
||
189 | |||
190 | /** |
||
191 | * @return EditCommandHandler|null |
||
192 | * |
||
193 | * @api |
||
194 | */ |
||
195 | public function getEditCommandHandler() |
||
199 | |||
200 | /** |
||
201 | * @param RemoveCommandHandler $commandHandler |
||
202 | * |
||
203 | * @api |
||
204 | */ |
||
205 | public function setRemoveCommandHandler(RemoveCommandHandler $commandHandler) |
||
209 | |||
210 | /** |
||
211 | * @return bool |
||
212 | * |
||
213 | * @api |
||
214 | */ |
||
215 | public function hasRemoveCommandHandler() |
||
219 | |||
220 | /** |
||
221 | * @return RemoveCommandHandler|null |
||
222 | * |
||
223 | * @api |
||
224 | */ |
||
225 | public function getRemoveCommandHandler() |
||
229 | |||
230 | /** |
||
231 | * @return IdentificationStrategy|IdentificationStrategy |
||
232 | * |
||
233 | * @api |
||
234 | */ |
||
235 | public function getIdentityStrategy() |
||
239 | |||
240 | /** |
||
241 | * @param $className |
||
242 | * @param Identity $idDefinition |
||
243 | * @param array $observedProperties |
||
244 | * @throws InvalidArgumentException |
||
245 | * @throws NotExistingPropertyException |
||
246 | */ |
||
247 | private function validatePropertyPaths($className, Identity $idDefinition, array $observedProperties) |
||
265 | } |
||
266 |