Skip to content

Commit

Permalink
removed unused personal pickup on order item
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin committed Nov 30, 2023
1 parent f88087b commit baa69a4
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 93 deletions.
32 changes: 28 additions & 4 deletions packages/framework/src/Migrations/Version20231124121921.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,36 @@ public function up(Schema $schema): void
$this->sql('COMMENT ON COLUMN closed_days.date IS \'(DC2Type:date_immutable)\'');
}

if (!$this->isAppMigrationNotInstalled('Version20230908095905')) {
return;
if ($this->isAppMigrationNotInstalledRemoveIfExists('Version20200331114558')) {
$this->sql('ALTER TABLE order_items ADD personal_pickup_stock_id INT DEFAULT NULL');
$this->sql('
ALTER TABLE
order_items
ADD
CONSTRAINT FK_62809DB078AE585C FOREIGN KEY (personal_pickup_stock_id) REFERENCES stocks (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->sql('CREATE INDEX IDX_62809DB078AE585C ON order_items (personal_pickup_stock_id)');
}

if ($this->isAppMigrationNotInstalledRemoveIfExists('Version20210712170052')) {
$this->sql('ALTER TABLE order_items DROP CONSTRAINT FK_62809DB078AE585C');
$this->sql('DROP INDEX IDX_62809DB078AE585C');
$this->sql('ALTER TABLE order_items RENAME COLUMN personal_pickup_stock_id TO personal_pickup_store_id');
$this->sql('
ALTER TABLE
order_items
ADD
CONSTRAINT FK_62809DB0C5F1915D FOREIGN KEY (personal_pickup_store_id) REFERENCES stores (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->sql('CREATE INDEX IDX_62809DB0C5F1915D ON order_items (personal_pickup_store_id)');
}

if ($this->isAppMigrationNotInstalled('Version20230908095905')) {
$this->sql('ALTER TABLE stores DROP opening_hours');
$this->sql('DROP TABLE product_stores');
}

$this->sql('ALTER TABLE stores DROP opening_hours');
$this->sql('DROP TABLE product_stores');
$this->sql('ALTER TABLE order_items DROP CONSTRAINT FK_62809DB0C5F1915D');
$this->sql('DROP INDEX IDX_62809DB0C5F1915D');
$this->sql('ALTER TABLE order_items DROP COLUMN personal_pickup_store_id');
}

/**
Expand Down
32 changes: 0 additions & 32 deletions project-base/app/src/Migrations/Version20200331114558.php

This file was deleted.

34 changes: 0 additions & 34 deletions project-base/app/src/Migrations/Version20210712170052.php

This file was deleted.

16 changes: 0 additions & 16 deletions project-base/app/src/Model/Order/Item/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Shopsys\FrameworkBundle\Model\Order\Item\OrderItem as BaseOrderItem;
use Shopsys\FrameworkBundle\Model\Order\Order as BaseOrder;
use Shopsys\FrameworkBundle\Model\Pricing\Price;
use Shopsys\FrameworkBundle\Model\Store\Store;

/**
* @ORM\Table(name="order_items")
Expand All @@ -29,13 +28,6 @@
*/
class OrderItem extends BaseOrderItem
{
/**
* @var \Shopsys\FrameworkBundle\Model\Store\Store|null
* @ORM\ManyToOne(targetEntity="Shopsys\FrameworkBundle\Model\Store\Store")
* @ORM\JoinColumn(name="personal_pickup_store_id", referencedColumnName="id", nullable=true)
*/
private $personalPickupStore;

/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
Expand Down Expand Up @@ -81,14 +73,6 @@ public function __construct(
);
}

/**
* @param \Shopsys\FrameworkBundle\Model\Store\Store|null $personalPickupStore
*/
public function setPersonalPickupStore(?Store $personalPickupStore): void
{
$this->personalPickupStore = $personalPickupStore;
}

/**
* @return string|null
*/
Expand Down
5 changes: 0 additions & 5 deletions project-base/app/src/Model/Order/Item/OrderItemData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
*/
class OrderItemData extends BaseOrderItemData
{
/**
* @var \Shopsys\FrameworkBundle\Model\Store\Store|null
*/
public $personalPickupStore;

/**
* @var string|null
*/
Expand Down
1 change: 0 additions & 1 deletion project-base/app/src/Model/Order/Item/OrderItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function createTransportByOrderItemData(OrderItemData $orderItemData, Ord
$orderItemData->quantity,
$orderItemData->transport,
);
$orderItem->setPersonalPickupStore($orderItemData->personalPickupStore);

return $orderItem;
}
Expand Down
1 change: 0 additions & 1 deletion project-base/app/src/Model/Order/OrderFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ protected function fillOrderTransport(BaseOrder $order, BaseOrderPreview $orderP

if ($pickupStore !== null) {
$transportName = sprintf('%s %s', $transportName, $pickupStore->getName());
$orderItemData->personalPickupStore = $pickupStore;
}

$orderItemData->name = $transportName;
Expand Down

0 comments on commit baa69a4

Please sign in to comment.