- Assigned to sagar25
- 🇩🇪Germany jocowood Kamp-Lintfort
I have debugged this problem together with a colleague, as we also want to use conflict together with scheduler.
We are pretty sure that this added line of code causes the problem:
https://git.drupalcode.org/project/conflict/-/commit/d1958eca3852ef55c87...The key/value pair
conflictWidget
will be added to thevalue
array of all fields. Later on the validation of the entity is triggered. Because of the additional information in thevalue
(heredata
) array, the array is not empty and is considered complex (see [1]). For this reason the array entries are validated individually. Because the datetime information is still null, the NotNullValidator reports a validation.Another negative side effect is, that the comparison of the local node and the server node in the conflict module always leads to the result "has changes". FieldComparatorDefault is the only available comparator, which does a simple equals comparison. This comparison is always false, because there is this additional entry
conflictWidget
.Proposed solution:
A) Place the
conflictWidget
information at a different locationB) Add a tidy up function, which is called, when conflict finished its job. We did a quick and dirty try at the end of
\Drupal\conflict\Entity\ContentEntityConflictHandler::entityFormEntityBuilder
, which seem to fix the bug.foreach (array_keys($form_display->getComponents()) as $field_name) { if ($entity->getFieldDefinition($field_name)) { unset($entity->get($field_name)->conflictWidget); } }
We are working on a patch, which we will provide soon.
[1] \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validateNode L.163
- 🇩🇪Germany jocowood Kamp-Lintfort
It turned out that the quick and dirty solution is also a good and clean solution. Here is a patch for conflict:2.0-alpha3
- last update
over 1 year ago 1 pass - Issue was unassigned.
- Status changed to RTBC
over 1 year ago 6:57am 26 May 2023