diff --git a/composer.lock b/composer.lock index 026b912894a58b3c1ec1f83e5d97d36a8b219955..7094255f7bf64b0bc059e22a84a03922341d8d45 100644 --- a/composer.lock +++ b/composer.lock @@ -1295,7 +1295,7 @@ "source": { "type": "git", "url": "https://github.com/seballot/mongodb-odm.git", - "reference": "b2d96c91cfb39f93861eb938d89ffb418f9083c5" + "reference": "0573d288d20f5b91db82765f4ec7be250da69a0b" }, "require": { "doctrine/annotations": "~1.2", @@ -1374,7 +1374,7 @@ "odm", "persistence" ], - "time": "2021-01-18T10:39:55+00:00" + "time": "2021-01-19T11:51:27+00:00" }, { "name": "doctrine/mongodb-odm-bundle", @@ -11474,8 +11474,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4" + "php": "^7.3" }, - "platform-dev": [], - "plugin-api-version": "2.0.0" + "platform-dev": [] } diff --git a/src/EventListener/ConfigurationListener.php b/src/EventListener/ConfigurationListener.php index 20fb78afa9e74b0b610dee4127b094c1be6428b8..cb244c4362f23c2539db4f4d635e8c28d7cb7088 100644 --- a/src/EventListener/ConfigurationListener.php +++ b/src/EventListener/ConfigurationListener.php @@ -25,29 +25,20 @@ class ConfigurationListener { $document = $args->getDocument(); $dm = $args->getDocumentManager(); - + $changeset = $dm->getChangeSet($document); // Update Json representation to fit the private property config - if ($document instanceof ConfigurationApi) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($document); + if ($document instanceof ConfigurationApi) { if (array_key_exists('publicApiPrivateProperties', $changeset)) { $this->asyncService->callCommand('app:elements:updateJson', ['ids' => 'all']); } } if ($document instanceof ConfigurationMarker) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($document); if (array_key_exists('fieldsUsedByTemplate', $changeset)) { $this->asyncService->callCommand('app:elements:updateJson', ['ids' => 'all']); } } if ($document instanceof Configuration) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($document); if (array_key_exists('elementFormFieldsJson', $changeset)) { $formFieldsChanged = $changeset['elementFormFieldsJson']; $oldFormFields = $formFieldsChanged[0]; diff --git a/src/EventListener/DatabaseIntegrityWatcher.php b/src/EventListener/DatabaseIntegrityWatcher.php index fc80524fe16b2301f45f6946567bf06cdc1a34e5..e5817aad93c2c18ee9854f787ea2b9bdbc950a4a 100755 --- a/src/EventListener/DatabaseIntegrityWatcher.php +++ b/src/EventListener/DatabaseIntegrityWatcher.php @@ -115,9 +115,7 @@ class DatabaseIntegrityWatcher // When changing the name of one Option, we need to update json representation of every element // using this option if ($document instanceof Option) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($document); + $changeset = $dm->getChangeSet($document); if (array_key_exists('name', $changeset)) { $elementIds = $dm->query('Element') ->field('optionValues.optionId')->in([$document->getId()]) @@ -150,9 +148,7 @@ class DatabaseIntegrityWatcher } } if (count($elementsFields)) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($element); + $changeset = $dm->getChangeSet($element); $elementIdsToUpdate = []; // If name have changed, update element which reference this element diff --git a/src/Services/ElementFormService.php b/src/Services/ElementFormService.php index cad4679c58a17dcd4d8654680b47950f706888e3..4231a38799d9fed6929e8ed464fa68ab67bafafa 100755 --- a/src/Services/ElementFormService.php +++ b/src/Services/ElementFormService.php @@ -44,9 +44,7 @@ class ElementFormService // Here is a function to detect minor changes private function isMinorModification($element, $originalElement, $dm) { - $uow = $dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($element); + $changeset = $dm->getChangeSet($element); $attributesChanged = array_keys($changeset); $sameOptionValues = $element->getOptionIds() == $originalElement->getOptionIds(); diff --git a/src/Services/ElementImportOneService.php b/src/Services/ElementImportOneService.php index 64cf06748ce828dc6e9fe01a72d887bdca98f23c..db5d0a5528d02c8018c17861b69fcbe7bbc6f7f9 100755 --- a/src/Services/ElementImportOneService.php +++ b/src/Services/ElementImportOneService.php @@ -46,8 +46,6 @@ class ElementImportOneService $this->dm->persist($option->getParent()); // Strange bug, need to manually persist parent } - // Getting the private field of the custom data - $config = $this->dm->get('Configuration')->findConfiguration(); $this->mainConfigHaveChangedSinceLastImport = $import->getMainConfigUpdatedAt() > $import->getLastRefresh(); } @@ -328,9 +326,7 @@ class ElementImportOneService // compare old and new element to see if something has changed private function checkElementHaveChanged($element) { - $uow = $this->dm->getUnitOfWork(); - $uow->computeChangeSets(); - $changeset = $uow->getDocumentChangeSet($element); + $changeset = $this->dm->getChangeSet($element); $changeset = array_filter($changeset, function($e) { $a = method_exists($e[0], 'toArray') ? $e[0]->toArray() : $e[0]; $b = method_exists($e[1], 'toArray') ? $e[1]->toArray() : $e[1];