5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Queue\QueueFactory;
29 $this->setConfigService($configService);
49 foreach ($this->getPropertyList() as $property_id) {
50 if (isset($data->{$property_id})) {
51 $this->processReferencesInDeletedProperty($property_id, $data->{$property_id});
66 foreach ($this->getPropertyList() as $property_id) {
67 if (!isset($old_dataset->{$property_id})) {
72 $oldProperty = $old_dataset->{$property_id};
73 $newProperty = (!isset($new_dataset->{$property_id})) ?
74 $this->emptyPropertyOfSameType($oldProperty) :
75 $new_dataset->{$property_id};
77 $this->processReferencesInUpdatedProperty($property_id, $oldProperty, $newProperty);
89 private function processReferencesInDeletedProperty($property_id, $uuids) {
91 if (!is_array($uuids)) {
94 foreach ($uuids as $uuid) {
95 $this->queueReferenceForRemoval($property_id, $uuid);
109 private function queueReferenceForRemoval($property_id, $uuid) {
110 $this->queueService->get(
'orphan_reference_processor')
127 private function processReferencesInUpdatedProperty($property_id, $old_value, $new_value) {
128 if (!is_array($old_value)) {
129 $old_value = [$old_value];
130 $new_value = [$new_value];
132 foreach (array_diff($old_value, $new_value) as $removed_reference) {
133 $this->queueReferenceForRemoval($property_id, $removed_reference);