Skip to content

Commit

Permalink
Merge pull request #2717 from dpfaffenbauer/named-lists
Browse files Browse the repository at this point in the history
[CoreBundle] implement name functions and add migration for order-name and wishlist-name
  • Loading branch information
dpfaffenbauer committed Sep 20, 2024
2 parents 47f4a0b + bc1b311 commit a4faa41
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 1 deletion.
Empty file added Dockerfile-franken
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace CoreShop\Bundle\CoreBundle\Migrations;

use CoreShop\Component\Pimcore\DataObject\ClassUpdate;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

final class Version20240920110320 extends AbstractMigration implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
$classUpdater = new ClassUpdate(
$this->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

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace CoreShop\Bundle\CoreBundle\Migrations;

use CoreShop\Component\Pimcore\DataObject\ClassUpdate;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

final class Version20240920110705 extends AbstractMigration implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
$classUpdater = new ClassUpdate(
$this->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

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"children": [
{
"name": "name",
"title": "coreshop.order.name",
"title": "coreshop.wishlist.name",
"tooltip": "",
"mandatory": false,
"noteditable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -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'
11 changes: 11 additions & 0 deletions src/CoreShop/Component/Core/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions src/CoreShop/Component/Core/Model/Wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
}
}

0 comments on commit a4faa41

Please sign in to comment.