Complex classes like Crud often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Crud, and based on these observations, apply Extract Interface, too.
1 | <?php declare (strict_types = 1); |
||
69 | class Crud implements CrudInterface |
||
70 | { |
||
71 | use HasContainerTrait; |
||
72 | |||
73 | /** Internal constant. Path constant. */ |
||
74 | protected const ROOT_PATH = ''; |
||
75 | |||
76 | /** Internal constant. Path constant. */ |
||
77 | protected const PATH_SEPARATOR = DocumentInterface::PATH_SEPARATOR; |
||
78 | |||
79 | /** |
||
80 | * @var FactoryInterface |
||
81 | */ |
||
82 | private $factory; |
||
83 | |||
84 | /** |
||
85 | * @var string |
||
86 | */ |
||
87 | private $modelClass; |
||
88 | |||
89 | /** |
||
90 | * @var ModelSchemaInfoInterface |
||
91 | */ |
||
92 | private $modelSchemas; |
||
93 | |||
94 | /** |
||
95 | * @var RelationshipPaginationStrategyInterface |
||
96 | */ |
||
97 | private $relPagingStrategy; |
||
98 | |||
99 | /** |
||
100 | * @var Connection |
||
101 | */ |
||
102 | private $connection; |
||
103 | |||
104 | /** |
||
105 | * @var iterable|null |
||
106 | */ |
||
107 | private $filterParameters = null; |
||
108 | |||
109 | /** |
||
110 | * @var bool |
||
111 | */ |
||
112 | private $areFiltersWithAnd = true; |
||
113 | |||
114 | /** |
||
115 | * @var iterable|null |
||
116 | */ |
||
117 | private $sortingParameters = null; |
||
118 | |||
119 | /** |
||
120 | * @var array |
||
121 | */ |
||
122 | private $relFiltersAndSorts = []; |
||
123 | |||
124 | /** |
||
125 | * @var iterable|null |
||
126 | */ |
||
127 | private $includePaths = null; |
||
128 | |||
129 | /** |
||
130 | * @var int|null |
||
131 | */ |
||
132 | private $pagingOffset = null; |
||
133 | |||
134 | /** |
||
135 | * @var Closure|null |
||
136 | */ |
||
137 | private $columnMapper = null; |
||
138 | |||
139 | /** |
||
140 | * @var bool |
||
141 | */ |
||
142 | private $isFetchTyped; |
||
143 | |||
144 | /** |
||
145 | * @var int|null |
||
146 | */ |
||
147 | private $pagingLimit = null; |
||
148 | |||
149 | /** internal constant */ |
||
150 | private const REL_FILTERS_AND_SORTS__FILTERS = 0; |
||
151 | |||
152 | /** internal constant */ |
||
153 | 61 | private const REL_FILTERS_AND_SORTS__SORTS = 1; |
|
154 | |||
155 | 61 | /** |
|
156 | * @param ContainerInterface $container |
||
157 | 61 | * @param string $modelClass |
|
158 | 61 | * |
|
159 | 61 | * @throws ContainerExceptionInterface |
|
160 | 61 | * @throws NotFoundExceptionInterface |
|
161 | 61 | */ |
|
162 | public function __construct(ContainerInterface $container, string $modelClass) |
||
174 | |||
175 | 1 | /** |
|
176 | * @param Closure $mapper |
||
177 | * |
||
178 | * @return self |
||
179 | */ |
||
180 | public function withColumnMapper(Closure $mapper): self |
||
186 | |||
187 | /** |
||
188 | * @inheritdoc |
||
189 | */ |
||
190 | public function withFilters(iterable $filterParameters): CrudInterface |
||
196 | 21 | ||
197 | /** |
||
198 | * @inheritdoc |
||
199 | */ |
||
200 | 21 | public function withIndexFilter(string $index): CrudInterface |
|
211 | |||
212 | /** |
||
213 | 2 | * @inheritdoc |
|
214 | */ |
||
215 | 2 | public function withIndexesFilter(array $indexes): CrudInterface |
|
240 | |||
241 | 7 | /** |
|
242 | * @inheritdoc |
||
243 | */ |
||
244 | public function withRelationshipFilters(string $name, iterable $filters): CrudInterface |
||
252 | |||
253 | 1 | /** |
|
254 | * @inheritdoc |
||
255 | */ |
||
256 | public function withRelationshipSorts(string $name, iterable $sorts): CrudInterface |
||
264 | |||
265 | /** |
||
266 | * @inheritdoc |
||
267 | */ |
||
268 | public function combineWithAnd(): CrudInterface |
||
274 | |||
275 | /** |
||
276 | * @inheritdoc |
||
277 | */ |
||
278 | public function combineWithOr(): CrudInterface |
||
284 | |||
285 | /** |
||
286 | * @return bool |
||
287 | 1 | */ |
|
288 | private function hasColumnMapper(): bool |
||
292 | |||
293 | /** |
||
294 | * @return Closure |
||
295 | 47 | */ |
|
296 | private function getColumnMapper(): Closure |
||
300 | |||
301 | /** |
||
302 | * @return bool |
||
303 | 36 | */ |
|
304 | private function hasFilters(): bool |
||
308 | |||
309 | /** |
||
310 | * @return iterable |
||
311 | 36 | */ |
|
312 | private function getFilters(): iterable |
||
316 | |||
317 | /** |
||
318 | * @return bool |
||
319 | 17 | */ |
|
320 | private function areFiltersWithAnd(): bool |
||
324 | |||
325 | /** |
||
326 | * @inheritdoc |
||
327 | */ |
||
328 | public function withSorts(iterable $sortingParameters): CrudInterface |
||
334 | |||
335 | /** |
||
336 | * @return bool |
||
337 | 11 | */ |
|
338 | private function hasSorts(): bool |
||
342 | |||
343 | /** |
||
344 | * @return iterable |
||
345 | 21 | */ |
|
346 | private function getSorts(): ?iterable |
||
350 | |||
351 | /** |
||
352 | * @inheritdoc |
||
353 | */ |
||
354 | public function withIncludes(iterable $includePaths): CrudInterface |
||
360 | |||
361 | /** |
||
362 | * @return bool |
||
363 | 21 | */ |
|
364 | private function hasIncludes(): bool |
||
368 | |||
369 | /** |
||
370 | * @return iterable |
||
371 | 20 | */ |
|
372 | private function getIncludes(): iterable |
||
376 | 20 | ||
377 | /** |
||
378 | * @inheritdoc |
||
379 | */ |
||
380 | public function withPaging(int $offset, int $limit): CrudInterface |
||
387 | 1 | ||
388 | /** |
||
389 | * @inheritdoc |
||
390 | */ |
||
391 | public function withoutPaging(): CrudInterface |
||
398 | |||
399 | /** |
||
400 | * @return self |
||
401 | */ |
||
402 | public function shouldBeTyped(): self |
||
408 | |||
409 | /** |
||
410 | * @return self |
||
411 | */ |
||
412 | public function shouldBeUntyped(): self |
||
418 | |||
419 | /** |
||
420 | * @return bool |
||
421 | 18 | */ |
|
422 | private function hasPaging(): bool |
||
426 | |||
427 | /** |
||
428 | * @return int |
||
429 | 18 | */ |
|
430 | private function getPagingOffset(): int |
||
434 | |||
435 | /** |
||
436 | * @return int |
||
437 | 43 | */ |
|
438 | private function getPagingLimit(): int |
||
442 | |||
443 | /** |
||
444 | * @return bool |
||
445 | 52 | */ |
|
446 | private function isFetchTyped(): bool |
||
450 | |||
451 | /** |
||
452 | * @return Connection |
||
453 | */ |
||
454 | protected function getConnection(): Connection |
||
458 | |||
459 | /** |
||
460 | * @param string $modelClass |
||
461 | * |
||
462 | * @return ModelQueryBuilder |
||
463 | */ |
||
464 | protected function createBuilder(string $modelClass): ModelQueryBuilder |
||
468 | 52 | ||
469 | /** |
||
470 | * @param Connection $connection |
||
471 | * @param string $modelClass |
||
472 | * |
||
473 | * @return ModelQueryBuilder |
||
474 | */ |
||
475 | private function createBuilderFromConnection(Connection $connection, string $modelClass): ModelQueryBuilder |
||
479 | 1 | ||
480 | /** |
||
481 | * @param ModelQueryBuilder $builder |
||
482 | 38 | * |
|
483 | * @return Crud |
||
484 | */ |
||
485 | protected function applyColumnMapper(ModelQueryBuilder $builder): self |
||
493 | |||
494 | 38 | /** |
|
495 | 27 | * @param ModelQueryBuilder $builder |
|
496 | 27 | * |
|
497 | 27 | * @return Crud |
|
498 | * |
||
499 | * @throws DBALException |
||
500 | 38 | */ |
|
501 | protected function applyAliasFilters(ModelQueryBuilder $builder): self |
||
511 | |||
512 | 4 | /** |
|
513 | 4 | * @param ModelQueryBuilder $builder |
|
514 | 4 | * |
|
515 | 4 | * @return self |
|
516 | * |
||
517 | * @throws DBALException |
||
518 | 4 | */ |
|
519 | protected function applyTableFilters(ModelQueryBuilder $builder): self |
||
529 | |||
530 | /** |
||
531 | 38 | * @param ModelQueryBuilder $builder |
|
532 | * |
||
533 | 38 | * @return self |
|
534 | 7 | * |
|
535 | 7 | * @throws DBALException |
|
536 | 7 | */ |
|
537 | 7 | protected function applyRelationshipFiltersAndSorts(ModelQueryBuilder $builder): self |
|
558 | |||
559 | 38 | /** |
|
560 | 4 | * @param ModelQueryBuilder $builder |
|
561 | * |
||
562 | * @return self |
||
563 | 38 | * |
|
564 | * @throws DBALException |
||
565 | */ |
||
566 | protected function applySorts(ModelQueryBuilder $builder): self |
||
574 | 18 | ||
575 | 18 | /** |
|
576 | * @param ModelQueryBuilder $builder |
||
577 | * |
||
578 | 45 | * @return self |
|
579 | */ |
||
580 | protected function applyPaging(ModelQueryBuilder $builder): self |
||
589 | 61 | ||
590 | 61 | /** |
|
591 | 61 | * @return self |
|
592 | 61 | */ |
|
593 | protected function clearBuilderParameters(): self |
||
605 | 61 | ||
606 | /** |
||
607 | * @return self |
||
608 | */ |
||
609 | private function clearFetchParameters(): self |
||
616 | |||
617 | /** |
||
618 | * @param ModelQueryBuilder $builder |
||
619 | * |
||
620 | * @return ModelQueryBuilder |
||
621 | */ |
||
622 | protected function builderOnCount(ModelQueryBuilder $builder): ModelQueryBuilder |
||
626 | |||
627 | /** |
||
628 | * @param ModelQueryBuilder $builder |
||
629 | * |
||
630 | * @return ModelQueryBuilder |
||
631 | */ |
||
632 | protected function builderOnIndex(ModelQueryBuilder $builder): ModelQueryBuilder |
||
636 | |||
637 | /** |
||
638 | * @param ModelQueryBuilder $builder |
||
639 | * |
||
640 | * @return ModelQueryBuilder |
||
641 | */ |
||
642 | protected function builderOnReadRelationship(ModelQueryBuilder $builder): ModelQueryBuilder |
||
646 | |||
647 | /** |
||
648 | * @param ModelQueryBuilder $builder |
||
649 | * |
||
650 | * @return ModelQueryBuilder |
||
651 | */ |
||
652 | protected function builderSaveResourceOnCreate(ModelQueryBuilder $builder): ModelQueryBuilder |
||
656 | |||
657 | /** |
||
658 | * @param ModelQueryBuilder $builder |
||
659 | * |
||
660 | * @return ModelQueryBuilder |
||
661 | */ |
||
662 | protected function builderSaveResourceOnUpdate(ModelQueryBuilder $builder): ModelQueryBuilder |
||
666 | 2 | ||
667 | /** |
||
668 | * @param string $relationshipName |
||
669 | * @param ModelQueryBuilder $builder |
||
670 | 2 | * |
|
671 | * @return ModelQueryBuilder |
||
672 | * |
||
673 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
674 | */ |
||
675 | protected function builderSaveRelationshipOnCreate(/** @noinspection PhpUnusedParameterInspection */ |
||
681 | 2 | ||
682 | /** |
||
683 | * @param string $relationshipName |
||
684 | * @param ModelQueryBuilder $builder |
||
685 | 2 | * |
|
686 | * @return ModelQueryBuilder |
||
687 | * |
||
688 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
689 | */ |
||
690 | protected function builderSaveRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
||
696 | 1 | ||
697 | /** |
||
698 | * @param string $relationshipName |
||
699 | * @param ModelQueryBuilder $builder |
||
700 | 1 | * |
|
701 | * @return ModelQueryBuilder |
||
702 | * |
||
703 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
704 | */ |
||
705 | protected function builderOnCreateInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
||
711 | 1 | ||
712 | /** |
||
713 | * @param string $relationshipName |
||
714 | * @param ModelQueryBuilder $builder |
||
715 | 1 | * |
|
716 | * @return ModelQueryBuilder |
||
717 | * |
||
718 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
719 | */ |
||
720 | protected function builderOnRemoveInBelongsToManyRelationship(/** @noinspection PhpUnusedParameterInspection */ |
||
726 | 2 | ||
727 | /** |
||
728 | * @param string $relationshipName |
||
729 | * @param ModelQueryBuilder $builder |
||
730 | 2 | * |
|
731 | * @return ModelQueryBuilder |
||
732 | * |
||
733 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
734 | */ |
||
735 | protected function builderCleanRelationshipOnUpdate(/** @noinspection PhpUnusedParameterInspection */ |
||
741 | |||
742 | /** |
||
743 | * @param ModelQueryBuilder $builder |
||
744 | * |
||
745 | * @return ModelQueryBuilder |
||
746 | */ |
||
747 | protected function builderOnDelete(ModelQueryBuilder $builder): ModelQueryBuilder |
||
751 | |||
752 | 21 | /** |
|
753 | * @param PaginatedDataInterface|mixed|null $data |
||
754 | 21 | * |
|
755 | 21 | * @return void |
|
756 | 21 | * |
|
757 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
758 | 21 | * |
|
759 | 21 | * @throws DBALException |
|
760 | 21 | */ |
|
761 | private function loadRelationships($data): void |
||
810 | |||
811 | /** |
||
812 | * A helper to remember all model related data. Helps to ensure we consistently handle models in CRUD. |
||
813 | * |
||
814 | 21 | * @param mixed $model |
|
815 | * @param string $path |
||
816 | * @param ModelSchemaInfoInterface $modelSchemas |
||
817 | * @param ModelStorageInterface $modelStorage |
||
818 | * @param TagStorageInterface $modelsAtPath |
||
819 | * @param ArrayObject $idsAtPath |
||
820 | * |
||
821 | * @return mixed |
||
822 | 21 | */ |
|
823 | 21 | private static function registerModelAtPath( |
|
841 | |||
842 | /** |
||
843 | * @param iterable $paths (string[]) |
||
844 | 21 | * |
|
845 | 21 | * @return iterable |
|
846 | 21 | */ |
|
847 | 10 | private static function getPaths(iterable $paths): iterable |
|
884 | |||
885 | /** |
||
886 | * @inheritdoc |
||
887 | * |
||
888 | * @throws DBALException |
||
889 | */ |
||
890 | public function createIndexBuilder(iterable $columns = null): QueryBuilder |
||
894 | |||
895 | /** |
||
896 | * @inheritdoc |
||
897 | * |
||
898 | * @throws DBALException |
||
899 | */ |
||
900 | public function createDeleteBuilder(): QueryBuilder |
||
904 | |||
905 | 38 | /** |
|
906 | * @param iterable|null $columns |
||
907 | * |
||
908 | 38 | * @return ModelQueryBuilder |
|
909 | * |
||
910 | * @throws DBALException |
||
911 | 38 | */ |
|
912 | 38 | protected function createIndexModelBuilder(iterable $columns = null): ModelQueryBuilder |
|
935 | 4 | ||
936 | 4 | /** |
|
937 | * @return ModelQueryBuilder |
||
938 | 4 | * |
|
939 | * @throws DBALException |
||
940 | 4 | */ |
|
941 | protected function createDeleteModelBuilder(): ModelQueryBuilder |
||
955 | 17 | ||
956 | /** |
||
957 | 17 | * @inheritdoc |
|
958 | * |
||
959 | * @throws DBALException |
||
960 | */ |
||
961 | public function index(): PaginatedDataInterface |
||
968 | 4 | ||
969 | /** |
||
970 | 4 | * @inheritdoc |
|
971 | 4 | * |
|
972 | * @throws DBALException |
||
973 | 4 | */ |
|
974 | public function indexIdentities(): array |
||
984 | |||
985 | 13 | /** |
|
986 | 13 | * @inheritdoc |
|
987 | * |
||
988 | 13 | * @throws DBALException |
|
989 | */ |
||
990 | public function read(string $index) |
||
999 | 2 | ||
1000 | 2 | /** |
|
1001 | * @inheritdoc |
||
1002 | 2 | * |
|
1003 | * @throws DBALException |
||
1004 | */ |
||
1005 | public function count(): ?int |
||
1013 | |||
1014 | /** |
||
1015 | 7 | * @param string $relationshipName |
|
1016 | * @param iterable|null $relationshipFilters |
||
1017 | * @param iterable|null $relationshipSorts |
||
1018 | * @param iterable|null $columns |
||
1019 | * |
||
1020 | * @return ModelQueryBuilder |
||
1021 | 7 | * |
|
1022 | 7 | * @throws DBALException |
|
1023 | 7 | */ |
|
1024 | public function createReadRelationshipBuilder( |
||
1068 | |||
1069 | /** |
||
1070 | 6 | * @inheritdoc |
|
1071 | 6 | * |
|
1072 | 6 | * @throws DBALException |
|
1073 | */ |
||
1074 | public function indexRelationship( |
||
1097 | |||
1098 | /** |
||
1099 | 2 | * @inheritdoc |
|
1100 | 2 | * |
|
1101 | 2 | * @throws DBALException |
|
1102 | */ |
||
1103 | public function indexRelationshipIdentities( |
||
1133 | |||
1134 | 3 | /** |
|
1135 | * @inheritdoc |
||
1136 | */ |
||
1137 | public function readRelationship( |
||
1145 | 1 | ||
1146 | 1 | /** |
|
1147 | * @inheritdoc |
||
1148 | */ |
||
1149 | 1 | public function hasInRelationship(string $parentId, string $name, string $childId): bool |
|
1167 | |||
1168 | 1 | /** |
|
1169 | * @inheritdoc |
||
1170 | 1 | * |
|
1171 | * @throws DBALException |
||
1172 | */ |
||
1173 | public function delete(): int |
||
1181 | |||
1182 | 4 | /** |
|
1183 | * @inheritdoc |
||
1184 | 3 | * |
|
1185 | * @throws DBALException |
||
1186 | 3 | */ |
|
1187 | public function remove(string $index): bool |
||
1197 | |||
1198 | 5 | /** |
|
1199 | * @inheritdoc |
||
1200 | 5 | * |
|
1201 | 5 | * @throws DBALException |
|
1202 | 5 | * |
|
1203 | 5 | * @SuppressWarnings(PHPMD.StaticAccess) |
|
1204 | */ |
||
1205 | 5 | public function create(?string $index, array $attributes, array $toMany): string |
|
1231 | |||
1232 | 5 | /** |
|
1233 | 5 | * @inheritdoc |
|
1234 | * |
||
1235 | * @throws DBALException |
||
1236 | 5 | * |
|
1237 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1238 | */ |
||
1239 | 5 | public function update(string $index, array $attributes, array $toMany): int |
|
1286 | |||
1287 | /** |
||
1288 | * @param string $parentId |
||
1289 | 1 | * @param string $name |
|
1290 | * @param iterable $childIds |
||
1291 | * |
||
1292 | * @return int |
||
1293 | 1 | * |
|
1294 | 1 | * @throws DBALException |
|
1295 | 1 | * |
|
1296 | 1 | * @SuppressWarnings(PHPMD.StaticAccess) |
|
1297 | */ |
||
1298 | 1 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1316 | |||
1317 | 1 | /** |
|
1318 | 1 | * @inheritdoc |
|
1319 | 1 | * |
|
1320 | 1 | * @throws DBALException |
|
1321 | */ |
||
1322 | 1 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
|
1338 | |||
1339 | /** |
||
1340 | * @return FactoryInterface |
||
1341 | 53 | */ |
|
1342 | protected function getFactory(): FactoryInterface |
||
1346 | |||
1347 | /** |
||
1348 | * @return string |
||
1349 | 53 | */ |
|
1350 | protected function getModelClass(): string |
||
1354 | |||
1355 | /** |
||
1356 | * @return ModelSchemaInfoInterface |
||
1357 | 8 | */ |
|
1358 | protected function getModelSchemas(): ModelSchemaInfoInterface |
||
1362 | |||
1363 | /** |
||
1364 | * @return RelationshipPaginationStrategyInterface |
||
1365 | */ |
||
1366 | protected function getRelationshipPagingStrategy(): RelationshipPaginationStrategyInterface |
||
1370 | |||
1371 | 10 | /** |
|
1372 | 10 | * @param Closure $closure |
|
1373 | * |
||
1374 | 10 | * @return void |
|
1375 | 8 | * |
|
1376 | 10 | * @throws DBALException |
|
1377 | */ |
||
1378 | public function inTransaction(Closure $closure): void |
||
1388 | |||
1389 | 22 | /** |
|
1390 | 13 | * @inheritdoc |
|
1391 | 13 | * |
|
1392 | * @throws DBALException |
||
1393 | */ |
||
1394 | 22 | public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface |
|
1405 | |||
1406 | 14 | /** |
|
1407 | 8 | * @inheritdoc |
|
1408 | 8 | * |
|
1409 | * @throws DBALException |
||
1410 | */ |
||
1411 | 14 | public function fetchResource(QueryBuilder $builder, string $modelClass) |
|
1422 | |||
1423 | 2 | /** |
|
1424 | * @inheritdoc |
||
1425 | 2 | * |
|
1426 | 2 | * @throws DBALException |
|
1427 | * |
||
1428 | 2 | * @SuppressWarnings(PHPMD.ElseExpression) |
|
1429 | 2 | */ |
|
1430 | 1 | public function fetchRow(QueryBuilder $builder, string $modelClass): ?array |
|
1451 | 5 | ||
1452 | /** |
||
1453 | 5 | * @inheritdoc |
|
1454 | 5 | * |
|
1455 | * @throws DBALException |
||
1456 | 5 | * |
|
1457 | 4 | * @SuppressWarnings(PHPMD.StaticAccess) |
|
1458 | 4 | * @SuppressWarnings(PHPMD.ElseExpression) |
|
1459 | 4 | */ |
|
1460 | 4 | public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable |
|
1485 | 2 | ||
1486 | 2 | /** |
|
1487 | * @param QueryBuilder $builder |
||
1488 | 2 | * |
|
1489 | * @return ModelQueryBuilder |
||
1490 | */ |
||
1491 | protected function createCountBuilderFromBuilder(QueryBuilder $builder): ModelQueryBuilder |
||
1499 | |||
1500 | /** |
||
1501 | * @param Connection $connection |
||
1502 | 5 | * @param string $primaryIdentity |
|
1503 | * @param string $name |
||
1504 | * @param iterable $secondaryIdentities |
||
1505 | * @param Closure $builderHook |
||
1506 | * |
||
1507 | * @return int |
||
1508 | * |
||
1509 | 5 | * @throws DBALException |
|
1510 | */ |
||
1511 | 5 | private function addInToManyRelationship( |
|
1542 | |||
1543 | /** |
||
1544 | 1 | * @param Connection $connection |
|
1545 | * @param string $primaryIdentity |
||
1546 | * @param string $name |
||
1547 | * @param iterable $secondaryIdentities |
||
1548 | * |
||
1549 | * @return int |
||
1550 | 1 | * |
|
1551 | 1 | * @throws DBALException |
|
1552 | */ |
||
1553 | 1 | private function removeInToManyRelationship( |
|
1569 | |||
1570 | /** |
||
1571 | 14 | * @param QueryBuilder $builder |
|
1572 | * @param string $modelClass |
||
1573 | 14 | * |
|
1574 | 14 | * @return mixed|null |
|
1575 | * |
||
1576 | 14 | * @throws DBALException |
|
1577 | 12 | * |
|
1578 | 12 | * @SuppressWarnings(PHPMD.ElseExpression) |
|
1579 | 12 | */ |
|
1580 | 12 | private function fetchResourceWithoutRelationships(QueryBuilder $builder, string $modelClass) |
|
1601 | |||
1602 | /** |
||
1603 | * @param QueryBuilder $builder |
||
1604 | 9 | * @param string $modelClass |
|
1605 | * @param string $keyColumnName |
||
1606 | * |
||
1607 | * @return iterable |
||
1608 | * |
||
1609 | 9 | * @throws DBALException |
|
1610 | * |
||
1611 | 9 | * @SuppressWarnings(PHPMD.ElseExpression) |
|
1612 | 8 | */ |
|
1613 | 8 | private function fetchResourcesWithoutRelationships( |
|
1635 | 27 | ||
1636 | /** |
||
1637 | * @param QueryBuilder $builder |
||
1638 | * @param string $modelClass |
||
1639 | 27 | * |
|
1640 | * @return PaginatedDataInterface |
||
1641 | 27 | * |
|
1642 | 27 | * @throws DBALException |
|
1643 | 27 | */ |
|
1644 | 27 | private function fetchPaginatedResourcesWithoutRelationships( |
|
1660 | |||
1661 | /** |
||
1662 | 27 | * @param QueryBuilder $builder |
|
1663 | * @param string $modelClass |
||
1664 | 27 | * |
|
1665 | * @return array |
||
1666 | 27 | * |
|
1667 | 27 | * @throws DBALException |
|
1668 | 27 | * |
|
1669 | 27 | * @SuppressWarnings(PHPMD.ElseExpression) |
|
1670 | */ |
||
1671 | 27 | private function fetchResourceCollection(QueryBuilder $builder, string $modelClass): array |
|
1706 | 5 | ||
1707 | 1 | /** |
|
1708 | 1 | * @param null|string $index |
|
1709 | * @param iterable $attributes |
||
1710 | * |
||
1711 | 5 | * @return iterable |
|
1712 | 5 | */ |
|
1713 | 5 | protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
|
1727 | 5 | ||
1728 | 5 | /** |
|
1729 | 5 | * @param iterable $attributes |
|
1730 | * |
||
1731 | * @return iterable |
||
1732 | */ |
||
1733 | protected function filterAttributesOnUpdate(iterable $attributes): iterable |
||
1742 | |||
1743 | /** |
||
1744 | * @param TagStorageInterface $modelsAtPath |
||
1745 | * @param ArrayObject $classAtPath |
||
1746 | * @param ArrayObject $idsAtPath |
||
1747 | * @param ModelStorageInterface $deDup |
||
1748 | * @param string $parentsPath |
||
1749 | 10 | * @param array $childRelationships |
|
1750 | * |
||
1751 | * @return void |
||
1752 | * |
||
1753 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
||
1754 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||
1755 | * |
||
1756 | * @throws DBALException |
||
1757 | 10 | */ |
|
1758 | 10 | private function loadRelationshipsLayer( |
|
1870 | 2 | ||
1871 | 2 | /** |
|
1872 | 2 | * @param string $message |
|
1873 | * |
||
1874 | 2 | * @return string |
|
1875 | * |
||
1876 | * @throws ContainerExceptionInterface |
||
1877 | * @throws NotFoundExceptionInterface |
||
1878 | */ |
||
1879 | private function getMessage(string $message): string |
||
1888 | |||
1889 | 34 | /** |
|
1890 | * @param string $class |
||
1891 | * @param array $attributes |
||
1892 | * @param Type[] $typeNames |
||
1893 | * @param AbstractPlatform $platform |
||
1894 | * |
||
1895 | 34 | * @return mixed |
|
1896 | 34 | * |
|
1897 | 34 | * @SuppressWarnings(PHPMD.StaticAccess) |
|
1898 | * |
||
1899 | * @throws DBALException |
||
1900 | 34 | */ |
|
1901 | private function readResourceFromAssoc( |
||
1914 | 1 | ||
1915 | /** |
||
1916 | 1 | * @param array $attributes |
|
1917 | 1 | * @param Type[] $typeNames |
|
1918 | 1 | * @param AbstractPlatform $platform |
|
1919 | * |
||
1920 | * @return array |
||
1921 | 1 | * |
|
1922 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
1923 | * |
||
1924 | * @throws DBALException |
||
1925 | */ |
||
1926 | private function readRowFromAssoc(array $attributes, array $typeNames, AbstractPlatform $platform): array |
||
1935 | 35 | ||
1936 | 35 | /** |
|
1937 | 35 | * @param iterable $attributes |
|
1938 | * @param array $typeNames |
||
1939 | * @param AbstractPlatform $platform |
||
1940 | * |
||
1941 | * @return iterable |
||
1942 | * |
||
1943 | * @throws DBALException |
||
1944 | */ |
||
1945 | private function readTypedAttributes(iterable $attributes, array $typeNames, AbstractPlatform $platform): iterable |
||
1952 | } |
||
1953 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..