Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding entities #24

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ imports:
monsieurbiz_sylius_shipping_slot:
expiration:
slot: '30 minutes'

sylius_resource:
resources:
monsieurbiz_shipping_slot.slot:
classes:
model: App\Entity\Shipping\Slot
26 changes: 26 additions & 0 deletions dist/src/Entity/Shipping/ShippingSlotConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* This file is part of SyliusShippingSlotPlugin website.
*
* (c) SyliusShippingSlotPlugin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace App\Entity\Shipping;

use Doctrine\ORM\Mapping as ORM;
use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingSlotConfig as BaseShippingSlotConfig;

/**
* @ORM\Entity
* @ORM\Table(name="monsieurbiz_shipping_slot_config")
*/
final class ShippingSlotConfig extends BaseShippingSlotConfig
{

}
26 changes: 26 additions & 0 deletions dist/src/Entity/Shipping/Slot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* This file is part of SyliusShippingSlotPlugin website.
*
* (c) SyliusShippingSlotPlugin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace App\Entity\Shipping;

use Doctrine\ORM\Mapping as ORM;
use MonsieurBiz\SyliusShippingSlotPlugin\Entity\Slot as BaseSlot;

/**
* @ORM\Entity
* @ORM\Table(name="monsieurbiz_shipping_slot_slot")
*/
final class Slot extends BaseSlot
{

}
18 changes: 9 additions & 9 deletions src/Entity/ShippingSlotConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@

class ShippingSlotConfig implements ShippingSlotConfigInterface
{
private ?int $id = null;
protected ?int $id = null;

private ?string $name = null;
protected ?string $name = null;

private ?string $timezone = null;
protected ?string $timezone = null;

private ?array $rrules = null;
protected ?array $rrules = null;

private ?int $preparationDelay = null;
protected ?int $preparationDelay = null;

private ?int $pickupDelay = null;
protected ?int $pickupDelay = null;

private ?int $durationRange = null;
protected ?int $durationRange = null;

private ?int $availableSpots = null;
protected ?int $availableSpots = null;

private ?string $color = null;
protected ?string $color = null;

public function getId(): ?int
{
Expand Down
14 changes: 7 additions & 7 deletions src/Entity/Slot.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ class Slot implements SlotInterface
{
use TimestampableTrait;

private ?int $id = null;
protected ?int $id = null;

private ?DateTimeInterface $timestamp = null;
protected ?DateTimeInterface $timestamp = null;

private ?int $preparationDelay = null;
protected ?int $preparationDelay = null;

private ?int $pickupDelay = null;
protected ?int $pickupDelay = null;

private ?int $durationRange = null;
protected ?int $durationRange = null;

private ?ShipmentInterface $shipment = null;
protected ?ShipmentInterface $shipment = null;

private ?ShippingSlotConfigInterface $shippingSlotConfig = null;
protected ?ShippingSlotConfigInterface $shippingSlotConfig = null;

public function getId(): ?int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/ShippingSlotConfig.orm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingSlotConfig" table="monsieurbiz_shipping_slot_config">
<mapped-superclass name="MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingSlotConfig" table="monsieurbiz_shipping_slot_config">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>
Expand All @@ -13,5 +13,5 @@
<field name="durationRange" column="duration_range" type="integer" nullable="true" />
<field name="availableSpots" column="available_spots" type="integer" nullable="true" />
<field name="color" column="color" type="string" length="10" nullable="true" />
</entity>
</mapped-superclass>
</doctrine-mapping>
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/Slot.orm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="MonsieurBiz\SyliusShippingSlotPlugin\Entity\Slot" table="monsieurbiz_shipping_slot_slot">
<mapped-superclass name="MonsieurBiz\SyliusShippingSlotPlugin\Entity\Slot" table="monsieurbiz_shipping_slot_slot">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>
Expand All @@ -21,5 +21,5 @@
<many-to-one field="shippingSlotConfig" target-entity="MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingSlotConfigInterface">
<join-column name="shipping_slot_config_id" on-delete="SET NULL" />
</many-to-one>
</entity>
</mapped-superclass>
</doctrine-mapping>
Loading