From 48c40e9c0375ed4544d44d123eb547b3b2602935 Mon Sep 17 00:00:00 2001 From: Jan Goralski Date: Mon, 22 Aug 2022 12:03:30 +0200 Subject: [PATCH 1/2] [UI] Fix autocomplete empty value --- .../UiBundle/Resources/private/js/sylius-auto-complete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-auto-complete.js b/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-auto-complete.js index 35fa2d8a8b..ab046cf37f 100644 --- a/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-auto-complete.js +++ b/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-auto-complete.js @@ -41,10 +41,10 @@ $.fn.extend({ value: item[choiceValue], })); - if (!element.hasClass('multiple')){ + if (!element.hasClass('multiple')) { results.unshift({ name: ' ', - value: ' ', + value: '', }); } From 77929a6a19f24b35d8162d305b2ec7382e134095 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Tue, 23 Aug 2022 14:21:48 +0200 Subject: [PATCH 2/2] [Adjustment] Adjustment cloning resets ID and timestamps --- UPGRADE-1.11.md | 4 ++++ src/Sylius/Component/Order/Model/Adjustment.php | 7 +++++++ src/Sylius/Component/Order/spec/Model/AdjustmentSpec.php | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/UPGRADE-1.11.md b/UPGRADE-1.11.md index 097975141b..fcdb563070 100644 --- a/UPGRADE-1.11.md +++ b/UPGRADE-1.11.md @@ -1,3 +1,7 @@ +# UPGRADE FROM `v1.11.7` TO `v1.11.8` + +1. Cloning `Sylius\Component\Order\Model\Adjustment` resets values of fields `id`, `createdAt` and `updatedAt`. + # UPGRADE FROM `v1.11.6` TO `v1.11.7` 1. Method `Sylius\Component\Channel\Repository\ChannelRepository::findOneByHostname` has become deprecated, use diff --git a/src/Sylius/Component/Order/Model/Adjustment.php b/src/Sylius/Component/Order/Model/Adjustment.php index dddb257e09..adaa1408ee 100644 --- a/src/Sylius/Component/Order/Model/Adjustment.php +++ b/src/Sylius/Component/Order/Model/Adjustment.php @@ -57,6 +57,13 @@ class Adjustment implements AdjustmentInterface $this->createdAt = new \DateTime(); } + public function __clone() + { + $this->id = null; + $this->createdAt = new \DateTime(); + $this->updatedAt = null; + } + public function getId() { return $this->id; diff --git a/src/Sylius/Component/Order/spec/Model/AdjustmentSpec.php b/src/Sylius/Component/Order/spec/Model/AdjustmentSpec.php index 774f5d531e..6ed6dcfbae 100644 --- a/src/Sylius/Component/Order/spec/Model/AdjustmentSpec.php +++ b/src/Sylius/Component/Order/spec/Model/AdjustmentSpec.php @@ -240,4 +240,13 @@ final class AdjustmentSpec extends ObjectBehavior $this->setDetails(['taxRateAmount' => 0.1]); $this->getDetails()->shouldReturn(['taxRateAmount' => 0.1]); } + + function it_resets_internal_information_while_cloning(): void + { + $this->setUpdatedAt(new \DateTime()); + $new = clone $this->getWrappedObject(); + + $this->getCreatedAt()->shouldNotBe($new->getCreatedAt()); + $this->getUpdatedAt()->shouldNotBe($new->getUpdatedAt()); + } }