Skip to content

Commit

Permalink
[CoreBundle] implement name functions and add migration for order-nam…
Browse files Browse the repository at this point in the history
…e and wishlist-name
  • Loading branch information
dpfaffenbauer committed Sep 20, 2024
1 parent 71dfc40 commit bc1b311
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__);
}
}

3 comments on commit bc1b311

@jdreesen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you now, like Pimcore, also lock the PRs after they have been merged (why actually?), I can't comment on that there, but...

did you commit the (empty) file Dockerfile-franken by mistake?

@dpfaffenbauer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from the CLA Workflow. I configured it the same as pimcore did, time will tell if that is good.

The Franken Dockerfile is by accident, I will remove it again

@dpfaffenbauer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the idea die the locking:

„It is highly recommended to lock the Pull Request after merging so that the Contributors won't be able to revoke their signature comments after merge“

Please sign in to comment.