From 3f31fafd758d1a231a7510020ed21c60dbc75651 Mon Sep 17 00:00:00 2001 From: Valentin Silvestre Date: Fri, 1 Mar 2024 11:02:43 +0100 Subject: [PATCH] add support for attributes --- src/Model/OrderItemUnitTrait.php | 1 + src/Model/OrderTrait.php | 4 ++++ src/Model/ProductTrait.php | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/Model/OrderItemUnitTrait.php b/src/Model/OrderItemUnitTrait.php index 80cf5cd6..7f14ea9f 100644 --- a/src/Model/OrderItemUnitTrait.php +++ b/src/Model/OrderItemUnitTrait.php @@ -9,6 +9,7 @@ trait OrderItemUnitTrait { /** @ORM\OneToOne (targetEntity="Setono\SyliusGiftCardPlugin\Model\GiftCardInterface", mappedBy="orderItemUnit") */ + #[ORM\OneToOne(targetEntity: \Setono\SyliusGiftCardPlugin\Model\GiftCardInterface::class, mappedBy: 'orderItemUnit')] protected ?GiftCardInterface $giftCard = null; public function getGiftCard(): ?GiftCardInterface diff --git a/src/Model/OrderTrait.php b/src/Model/OrderTrait.php index e28519a2..0d7c006e 100644 --- a/src/Model/OrderTrait.php +++ b/src/Model/OrderTrait.php @@ -25,6 +25,10 @@ trait OrderTrait * inverseJoinColumns={@ORM\JoinColumn(name="gift_card_id", referencedColumnName="id", onDelete="CASCADE")} * ) */ + #[ORM\JoinTable(name: 'setono_sylius_gift_card__order_gift_cards')] + #[ORM\JoinColumn(name: 'order_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\InverseJoinColumn(name: 'gift_card_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\ManyToMany(targetEntity: \Setono\SyliusGiftCardPlugin\Model\GiftCardInterface::class, inversedBy: 'appliedOrders')] protected Collection $giftCards; public function __construct() diff --git a/src/Model/ProductTrait.php b/src/Model/ProductTrait.php index e4bad295..554241c5 100644 --- a/src/Model/ProductTrait.php +++ b/src/Model/ProductTrait.php @@ -9,9 +9,11 @@ trait ProductTrait { /** @ORM\Column(type="boolean", options={"default": false}) */ + #[ORM\Column(type: 'boolean', options: ['default' => false])] protected bool $giftCard = false; /** @ORM\Column(type="boolean", options={"default": false}) */ + #[ORM\Column(type: 'boolean', options: ['default' => false])] protected bool $giftCardAmountConfigurable = false; public function isGiftCard(): bool