From bc1b311c0405cd82531c78083e3795ce99264949 Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Fri, 20 Sep 2024 13:11:09 +0200 Subject: [PATCH] [CoreBundle] implement name functions and add migration for order-name and wishlist-name --- Dockerfile-franken | 0 .../Migrations/Version20240920110320.php | 67 +++++++++++++++++++ .../Migrations/Version20240920110705.php | 67 +++++++++++++++++++ .../CoreShopWishlist.json | 2 +- .../Resources/translations/admin.de.yml | 1 + .../Resources/translations/admin.en.yml | 1 + src/CoreShop/Component/Core/Model/Order.php | 11 +++ .../Component/Core/Model/Wishlist.php | 10 +++ 8 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 Dockerfile-franken create mode 100644 src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110320.php create mode 100644 src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110705.php diff --git a/Dockerfile-franken b/Dockerfile-franken new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110320.php b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110320.php new file mode 100644 index 0000000000..9ba888cb8a --- /dev/null +++ b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110320.php @@ -0,0 +1,67 @@ +container->getParameter('coreshop.model.order.pimcore_class_name'), + ); + + if ($classUpdater->hasField('name')) { + return; + } + + $nameField = [ + "name" => "name", + "title" => "coreshop.order.name", + "tooltip" => "", + "mandatory" => false, + "noteditable" => true, + "index" => false, + "locked" => false, + "style" => "", + "permissions" => null, + "fieldtype" => "input", + "relationType" => false, + "invisible" => false, + "visibleGridView" => false, + "visibleSearch" => false, + "defaultValue" => null, + "columnLength" => 190, + "regex" => "", + "regexFlags" => [], + "unique" => false, + "showCharCount" => false, + "width" => "", + "defaultValueGenerator" => "", + "datatype" => "data", + ]; + + $classUpdater->insertFieldBefore('orderNumber', $nameField); + $classUpdater->save(); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110705.php b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110705.php new file mode 100644 index 0000000000..9aa0aafc2c --- /dev/null +++ b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20240920110705.php @@ -0,0 +1,67 @@ +container->getParameter('coreshop.model.wishlist.pimcore_class_name'), + ); + + if ($classUpdater->hasField('name')) { + return; + } + + $nameField = [ + "name" => "name", + "title" => "coreshop.wishlist.name", + "tooltip" => "", + "mandatory" => false, + "noteditable" => true, + "index" => false, + "locked" => false, + "style" => "", + "permissions" => null, + "fieldtype" => "input", + "relationType" => false, + "invisible" => false, + "visibleGridView" => false, + "visibleSearch" => false, + "defaultValue" => null, + "columnLength" => 190, + "regex" => "", + "regexFlags" => [], + "unique" => false, + "showCharCount" => false, + "width" => "", + "defaultValueGenerator" => "", + "datatype" => "data", + ]; + + $classUpdater->insertFieldBefore('token', $nameField); + $classUpdater->save(); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/install/pimcore/classes/CoreShopWishlistBundle/CoreShopWishlist.json b/src/CoreShop/Bundle/CoreBundle/Resources/install/pimcore/classes/CoreShopWishlistBundle/CoreShopWishlist.json index cd1b8f847a..58198d5f5f 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/install/pimcore/classes/CoreShopWishlistBundle/CoreShopWishlist.json +++ b/src/CoreShop/Bundle/CoreBundle/Resources/install/pimcore/classes/CoreShopWishlistBundle/CoreShopWishlist.json @@ -38,7 +38,7 @@ "children": [ { "name": "name", - "title": "coreshop.order.name", + "title": "coreshop.wishlist.name", "tooltip": "", "mandatory": false, "noteditable": true, diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml index 6acece0ab1..44640cd0a0 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml @@ -247,3 +247,4 @@ coreshop_customer_transformer_assignment_form_new_company_title: 'Neue Unternehm coreshop_customer_transformer_assignment_new_form_button: 'Firma erstellen und Kunden zuweisen' coreshop_customer_transformer_assignment_new_form_description: 'Nach Absenden dieses Formulars wird ein neues Unternehmen erstellt. Bitte überprüfen Sie die Daten sorgfältig. Darüber hinaus müssen Sie festlegen, ob die Kundenadressen vom Kunden gespeichert oder an das neue Unternehmen übertragen werden sollen.' coreshop_customer_transformer_assignment_new_form_maybe_duplicates_title: 'Ähnliche Unternehmen' +coreshop.wishlist.name: 'Name' diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml index 105beadf34..5eac58b2e0 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml @@ -247,3 +247,4 @@ coreshop_customer_transformer_assignment_form_new_company_title: 'New Company Da coreshop_customer_transformer_assignment_new_form_button: 'Create Company and assign Customer' coreshop_customer_transformer_assignment_new_form_description: 'Once this form is submitted, a new company will be created. Please check the data carefully. In addition, you must define whether the customer addresses are to be retained by the customer or transferred to the new company.' coreshop_customer_transformer_assignment_new_form_maybe_duplicates_title: 'Similar Companies' +coreshop.wishlist.name: 'Name' diff --git a/src/CoreShop/Component/Core/Model/Order.php b/src/CoreShop/Component/Core/Model/Order.php index 67cd392b51..fd2e330404 100644 --- a/src/CoreShop/Component/Core/Model/Order.php +++ b/src/CoreShop/Component/Core/Model/Order.php @@ -20,12 +20,23 @@ use CoreShop\Component\Order\Model\AdjustmentInterface; use CoreShop\Component\Order\Model\Order as BaseOrder; +use CoreShop\Component\Resource\Exception\ImplementedByPimcoreException; use CoreShop\Component\Shipping\Model\CarrierAwareTrait; abstract class Order extends BaseOrder implements OrderInterface { use CarrierAwareTrait; + public function getName(): ?string + { + throw new ImplementedByPimcoreException(__CLASS__, __METHOD__); + } + + public function setName(?string $name) + { + throw new ImplementedByPimcoreException(__CLASS__, __METHOD__); + } + public function getShipping(bool $withTax = true): int { return $withTax ? $this->getAdjustmentsTotal(AdjustmentInterface::SHIPPING, true) : $this->getAdjustmentsTotal(AdjustmentInterface::SHIPPING, false); diff --git a/src/CoreShop/Component/Core/Model/Wishlist.php b/src/CoreShop/Component/Core/Model/Wishlist.php index f74f99ae52..e6fdca47e8 100644 --- a/src/CoreShop/Component/Core/Model/Wishlist.php +++ b/src/CoreShop/Component/Core/Model/Wishlist.php @@ -18,8 +18,18 @@ namespace CoreShop\Component\Core\Model; +use CoreShop\Component\Resource\Exception\ImplementedByPimcoreException; use CoreShop\Component\Wishlist\Model\Wishlist as BaseWishlist; abstract class Wishlist extends BaseWishlist implements WishlistInterface { + public function getName(): ?string + { + throw new ImplementedByPimcoreException(__CLASS__, __METHOD__); + } + + public function setName(?string $name) + { + throw new ImplementedByPimcoreException(__CLASS__, __METHOD__); + } }