Skip to content

Commit

Permalink
[Bug]: Fix type error in NumericRange constructor when using decimals
Browse files Browse the repository at this point in the history
Resolves pimcore#17700
  • Loading branch information
Brainshaker95 authored and mattamon committed Oct 18, 2024
1 parent f0620ff commit 4c3a006
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions models/DataObject/ClassDefinition/Data/NumericRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,18 @@ public function getDataForResource(mixed $data, DataObject\Concrete $object = nu
public function getDataFromResource(mixed $data, DataObject\Concrete $object = null, array $params = []): ?DataObject\Data\NumericRange
{
if (isset($data[$this->getName() . '__minimum'], $data[$this->getName() . '__maximum'])) {
$numericRange = new DataObject\Data\NumericRange(
$data[$this->getName() . '__minimum'],
$data[$this->getName() . '__maximum']
);
$minimum = $data[$this->getName() . '__minimum'];
$maximum = $data[$this->getName() . '__maximum'];

if (is_string($minimum)) {
$minimum = (float) $minimum;
}

if (is_string($maximum)) {
$maximum = (float) $maximum;
}

$numericRange = new DataObject\Data\NumericRange($minimum, $maximum);

if (isset($params['owner'])) {
$numericRange->_setOwner($params['owner']);
Expand Down

0 comments on commit 4c3a006

Please sign in to comment.