/** * @param $changeInfoList * @param array $indicies * @param string $resultAction */ private function replaceChangeInfosCombination(&$changeInfoList, $indicies, $resultAction) { $entities = $this->getChangeInfosByIndicies($changeInfoList, $indicies); foreach ($entities as $entityId => $changeInfos) { if (count($changeInfos) == 2) { /** @var EntityChangeInfo $sourceChangeInfo */ $sourceChangeInfo = $changeInfoList[$changeInfos[$indicies[0]][0]]; $this->removeChangeInfos($changeInfoList, $changeInfos); $fakeEntity = ['vp_id' => $sourceChangeInfo->getId()]; $changeInfoList[] = $this->changeInfoFactory->createEntityChangeInfo($fakeEntity, 'post', $resultAction, $sourceChangeInfo->getCustomTags(), $sourceChangeInfo->getChangedFiles()); } } }
private function createChangeInfo($oldEntity, $newEntity, $action) { $entityName = $this->entityInfo->entityName; $entity = array_merge($oldEntity, $newEntity); $changeInfo = $this->changeInfoFactory->createEntityChangeInfo($entity, $entityName, $action); $files = $changeInfo->getChangedFiles(); $action = apply_filters("vp_entity_action_{$entityName}", $action, $oldEntity, $newEntity); $tags = apply_filters("vp_entity_tags_{$entityName}", $changeInfo->getCustomTags(), $oldEntity, $newEntity, $action); $files = apply_filters("vp_entity_files_{$entityName}", $files, $oldEntity, $newEntity); return $this->changeInfoFactory->createEntityChangeInfo($entity, $entityName, $action, $tags, $files); }