Fixed wrongly detected changes of prices caused by not identical objects.

This commit is contained in:
Jan Böhmer 2020-05-20 22:45:41 +02:00
parent f92802a3c7
commit c60f27ef86
3 changed files with 23 additions and 3 deletions

View file

@ -275,7 +275,11 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*/
public function setPrice(BigDecimal $new_price): self
{
$this->price = $new_price->toScale(self::PRICE_PRECISION, RoundingMode::HALF_UP);
$tmp = $new_price->toScale(self::PRICE_PRECISION, RoundingMode::HALF_UP);
//Only change the object, if the value changes, so that doctrine does not detect it as changed.
if ((string) $tmp !== (string) $this->price) {
$this->price = $tmp;
}
return $this;
}