[Form] Update DateTime objects only if the actual value has changed
This commit is contained in:
parent
0808ceb1fe
commit
1f22d3a564
@ -81,6 +81,13 @@ class PropertyPathMapper implements DataMapperInterface
|
||||
// Write-back is disabled if the form is not synchronized (transformation failed),
|
||||
// if the form was not submitted and if the form is disabled (modification not allowed)
|
||||
if (null !== $propertyPath && $config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled()) {
|
||||
|
||||
// If the field is of type DateTime and the data is the same skip the update to
|
||||
// keep the original object hash
|
||||
if ($form->getData() instanceof \DateTime && $form->getData() == $this->propertyAccessor->getValue($data, $propertyPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the data is identical to the value in $data, we are
|
||||
// dealing with a reference
|
||||
if (!is_object($data) || !$config->getByReference() || $form->getData() !== $this->propertyAccessor->getValue($data, $propertyPath)) {
|
||||
|
Reference in New Issue
Block a user