Skip to content

Commit

Permalink
Merge tag '2.3.15'
Browse files Browse the repository at this point in the history
Bugfix release 2.3.15

Fixes an encoding problem when updating model values (#642)
  • Loading branch information
discordier committed Jul 17, 2024
2 parents ad092d0 + 43ad114 commit efe5e2d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Contao/View/Contao2BackendView/ContaoWidgetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ public function __construct(EnvironmentInterface $environment, ModelInterface $m
/**
* Encode a value from the widget to native data of the data provider via event.
*
* @param string $property The property.
* @param mixed $value The value of the property.
* @param PropertyValueBag $propertyValues The property value bag the property value originates from.
* @param string $property The property.
* @param mixed $value The value of the property.
* @param PropertyValueBagInterface $propertyValues The property value bag the property value originates from.
*
* @return mixed
*/
public function encodeValue($property, $value, PropertyValueBag $propertyValues)
public function encodeValue($property, $value, PropertyValueBagInterface $propertyValues)
{
$environment = $this->getEnvironment();
$dispatcher = $environment->getEventDispatcher();
Expand Down Expand Up @@ -303,7 +303,14 @@ public function getWidget($property, PropertyValueBagInterface $inputValues = nu
$controller = $environment->getController();
assert($controller instanceof ControllerInterface);

$values = new PropertyValueBag($inputValues->getArrayCopy());
$values = new PropertyValueBag();
foreach ($inputValues->getIterator() as $propertyName => $propertyValue) {
$values->setPropertyValue(
$propertyName,
$this->encodeValue($propertyName, $propertyValue, $inputValues)
);
}

$controller->updateModelFromPropertyBag($model, $values);
}

Expand Down

0 comments on commit efe5e2d

Please sign in to comment.