| @@ 235-254 (lines=20) @@ | ||
| 232 | ->toArray(); |
|
| 233 | } |
|
| 234 | ||
| 235 | private function setUpPreSaveVisits() |
|
| 236 | { |
|
| 237 | // set up the pre save property visits |
|
| 238 | $this->preSaveVisits = array_merge( |
|
| 239 | $this->preSaveVisits, |
|
| 240 | Psi::it($this->getMarkedProperties()) |
|
| 241 | ->filter(new Psi\IsInstanceOf(PropertyMarkedForSlumber::class)) |
|
| 242 | ->filter(function (PropertyMarkedForSlumber $p) { |
|
| 243 | return $p->getFirstMarkerOf(PropertyPreSaveVisitorMarker::class) !== null; |
|
| 244 | }) |
|
| 245 | ->map(function (PropertyMarkedForSlumber $p) { |
|
| 246 | $res = new PropertyMarkedForPreSaveVisit(); |
|
| 247 | $res->propertyName = $p->name; |
|
| 248 | $res->markers = $p->getMarkersOf(PropertyPreSaveVisitorMarker::class); |
|
| 249 | ||
| 250 | return $res; |
|
| 251 | }) |
|
| 252 | ->toArray() |
|
| 253 | ); |
|
| 254 | } |
|
| 255 | ||
| 256 | private function setUpPostSaveClassListeners() |
|
| 257 | { |
|
| @@ 276-296 (lines=21) @@ | ||
| 273 | ); |
|
| 274 | } |
|
| 275 | ||
| 276 | private function setUpIndexedProperties() |
|
| 277 | { |
|
| 278 | // get indexed properties |
|
| 279 | // TODO: write tests |
|
| 280 | $this->indexedProperties = array_merge( |
|
| 281 | $this->indexedProperties, |
|
| 282 | Psi::it($this->getMarkedProperties()) |
|
| 283 | ->filter(new Psi\IsInstanceOf(PropertyMarkedForSlumber::class)) |
|
| 284 | ->filter(function (PropertyMarkedForSlumber $p) { |
|
| 285 | return $p->getFirstMarkerOf(PropertyStorageIndexMarker::class) !== null; |
|
| 286 | }) |
|
| 287 | ->map(function (PropertyMarkedForSlumber $p) { |
|
| 288 | $res = new PropertyMarkedForIndexing(); |
|
| 289 | $res->propertyName = $p->name; |
|
| 290 | $res->markers = $p->getMarkersOf(PropertyStorageIndexMarker::class); |
|
| 291 | ||
| 292 | return $res; |
|
| 293 | }) |
|
| 294 | ->toArray() |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | ||
| 298 | private function setUpCompoundIndexes() |
|
| 299 | { |
|