@@ 68-88 (lines=21) @@ | ||
65 | * @throws \Nnx\FormComparator\Comparator\Exception\DomainException |
|
66 | * @throws \Nnx\FormComparator\Comparator\CollectionDiffService\Exception\RuntimeException |
|
67 | */ |
|
68 | public function buildDiffInsertedCollection(Collection $insertedCollection, $prefixPath) |
|
69 | { |
|
70 | Assert::string($prefixPath); |
|
71 | Assert::notEmpty($prefixPath); |
|
72 | ||
73 | $collectionElementsInfo = $this->buildInfoForCollectionElements($insertedCollection, $prefixPath); |
|
74 | ||
75 | $diff = []; |
|
76 | ||
77 | foreach ($collectionElementsInfo as $rowUniqueId => $info) { |
|
78 | $builder = $this->diffCollectionElementBuilderFactory(DiffCollectionElementBuilder::INSERT_ELEMENT_MODE); |
|
79 | $builder->setSourceHash($info['hash']) |
|
80 | ->setRowIndex($info['rowIndex']) |
|
81 | ->setSourceCollectionElement($info['element']) |
|
82 | ->setUniqueRowId($info['rowUniqueId']) |
|
83 | ->setPathToElement($info['pathToElement']); |
|
84 | $diff[] = $builder->build(); |
|
85 | } |
|
86 | ||
87 | return $diff; |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Подготавливает объекты описывающие элементы удаленной коллекции |
|
@@ 100-120 (lines=21) @@ | ||
97 | * @throws \Nnx\FormComparator\Comparator\Exception\DomainException |
|
98 | * @throws \Nnx\FormComparator\Comparator\CollectionDiffService\Exception\RuntimeException |
|
99 | */ |
|
100 | public function buildDiffDeletedCollection(Collection $deletedCollection, $prefixPath) |
|
101 | { |
|
102 | Assert::string($prefixPath); |
|
103 | Assert::notEmpty($prefixPath); |
|
104 | ||
105 | $collectionElementsInfo = $this->buildInfoForCollectionElements($deletedCollection, $prefixPath); |
|
106 | ||
107 | $diff = []; |
|
108 | ||
109 | foreach ($collectionElementsInfo as $rowUniqueId => $info) { |
|
110 | $builder = $this->diffCollectionElementBuilderFactory(DiffCollectionElementBuilder::DELETE_ELEMENT_MODE); |
|
111 | $builder->setSourceHash($info['hash']) |
|
112 | ->setRowIndex($info['rowIndex']) |
|
113 | ->setSourceCollectionElement($info['element']) |
|
114 | ->setUniqueRowId($info['rowUniqueId']) |
|
115 | ->setPathToElement($info['pathToElement']); |
|
116 | $diff[] = $builder->build(); |
|
117 | } |
|
118 | ||
119 | return $diff; |
|
120 | } |
|
121 | ||
122 | ||
123 | /** |