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

Make entities extendable #97

Merged
merged 2 commits into from
Jun 10, 2019
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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

"knplabs/knp-snappy-bundle": "^1.5",
"ramsey/uuid": "^3.7",
"sylius/resource-bundle": "^1.6.0-RC.2",
"symfony/config": "^4.2",
"symfony/dependency-injection": "^4.2",
"symfony/form": "^4.2",
Expand Down
20 changes: 10 additions & 10 deletions src/Entity/BillingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
class BillingData implements BillingDataInterface, ResourceInterface
{
/** @var int */
private $id;
protected $id;

/** @var string */
private $firstName;
protected $firstName;

/** @var string */
private $lastName;
protected $lastName;

/** @var string|null */
private $company;
protected $company;

/** @var string */
private $countryCode;
protected $countryCode;

/** @var string|null */
private $provinceCode;
protected $provinceCode;

/** @var string|null */
private $provinceName;
protected $provinceName;

/** @var string */
private $street;
protected $street;

/** @var string */
private $city;
protected $city;

/** @var string */
private $postcode;
protected $postcode;

public function __construct(
string $firstName,
Expand Down
24 changes: 12 additions & 12 deletions src/Entity/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,40 @@
class Invoice implements InvoiceInterface, ResourceInterface
{
/** @var string */
private $id;
protected $id;

/** @var string */
private $number;
protected $number;

/** @var string */
private $orderNumber;
protected $orderNumber;

/** @var \DateTimeInterface */
private $issuedAt;
protected $issuedAt;

/** @var BillingDataInterface */
private $billingData;
protected $billingData;

/** @var string */
private $currencyCode;
protected $currencyCode;

/** @var string */
private $localeCode;
protected $localeCode;

/** @var int */
private $total;
protected $total;

/** @var Collection|LineItemInterface[] */
private $lineItems;
protected $lineItems;

/** @var Collection|TaxItemInterface[] */
private $taxItems;
protected $taxItems;

/** @var InvoiceChannelInterface */
private $channel;
protected $channel;

/** @var InvoiceShopBillingDataInterface */
private $shopBillingData;
protected $shopBillingData;

public function __construct(
string $id,
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/InvoiceChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
class InvoiceChannel implements InvoiceChannelInterface
{
/** @var string */
private $code;
protected $code;

/** @var string */
private $name;
protected $name;

public function __construct(string $code, string $name)
{
Expand Down
17 changes: 9 additions & 8 deletions src/Entity/InvoiceShopBillingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@

namespace Sylius\InvoicingPlugin\Entity;

final class InvoiceShopBillingData implements InvoiceShopBillingDataInterface
/** @final */
class InvoiceShopBillingData implements InvoiceShopBillingDataInterface
{
/** @var string|null */
private $company;
protected $company;

/** @var string|null */
private $taxId;
protected $taxId;

/** @var string|null */
private $countryCode;
protected $countryCode;

/** @var string|null */
private $street;
protected $street;

/** @var string|null */
private $city;
protected $city;

/** @var string|null */
private $postcode;
protected $postcode;

/** @var string|null */
private $representative;
protected $representative;

public function getCompany(): ?string
{
Expand Down
20 changes: 10 additions & 10 deletions src/Entity/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
class LineItem implements LineItemInterface, ResourceInterface
{
/** @var string */
private $id;
protected $id;

/** @var InvoiceInterface */
private $invoice;
protected $invoice;

/** @var string */
private $name;
protected $name;

/** @var string|null */
private $variantName;
protected $variantName;

/** @var string|null */
private $variantCode;
protected $variantCode;

/** @var int */
private $quantity;
protected $quantity;

/** @var int */
private $unitPrice;
protected $unitPrice;

/** @var int */
private $subtotal;
protected $subtotal;

/** @var int */
private $taxTotal;
protected $taxTotal;

/** @var int */
private $total;
protected $total;

public function __construct(
string $name,
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/TaxItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class TaxItem implements TaxItemInterface, ResourceInterface
{
/** @var string */
private $id;
protected $id;

/** @var InvoiceInterface */
private $invoice;
protected $invoice;

/** @var string */
private $label;
protected $label;

/** @var int */
private $amount;
protected $amount;

public function __construct(string $label, int $amount)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/BillingData.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="Sylius\InvoicingPlugin\Entity\BillingData" table="sylius_invoicing_plugin_billing_data">
<mapped-superclass name="Sylius\InvoicingPlugin\Entity\BillingData" table="sylius_invoicing_plugin_billing_data">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
Expand All @@ -15,5 +15,5 @@
<field name="countryCode" column="country_code" />
<field name="provinceCode" column="province_code" nullable="true" />
<field name="provinceName" column="province_name" nullable="true" />
</entity>
</mapped-superclass>
</doctrine-mapping>
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/Invoice.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="Sylius\InvoicingPlugin\Entity\Invoice" table="sylius_invoicing_plugin_invoice">
<mapped-superclass name="Sylius\InvoicingPlugin\Entity\Invoice" table="sylius_invoicing_plugin_invoice">
<id name="id" column="id" type="string" />

<field name="number" column="number" />
Expand Down Expand Up @@ -37,5 +37,5 @@
<indexes>
<index columns="order_number" />
</indexes>
</entity>
</mapped-superclass>
</doctrine-mapping>
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/LineItem.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="Sylius\InvoicingPlugin\Entity\LineItem" table="sylius_invoicing_plugin_line_item">
<mapped-superclass name="Sylius\InvoicingPlugin\Entity\LineItem" table="sylius_invoicing_plugin_line_item">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
Expand All @@ -18,5 +18,5 @@
<many-to-one field="invoice" target-entity="Sylius\InvoicingPlugin\Entity\InvoiceInterface" inversed-by="lineItems">
<join-column name="invoice_id" nullable="false" on-delete="CASCADE" />
</many-to-one>
</entity>
</mapped-superclass>
</doctrine-mapping>
4 changes: 2 additions & 2 deletions src/Resources/config/doctrine/TaxItem.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="Sylius\InvoicingPlugin\Entity\TaxItem" table="sylius_invoicing_plugin_tax_item">
<mapped-superclass name="Sylius\InvoicingPlugin\Entity\TaxItem" table="sylius_invoicing_plugin_tax_item">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
Expand All @@ -12,5 +12,5 @@
<many-to-one field="invoice" target-entity="Sylius\InvoicingPlugin\Entity\InvoiceInterface" inversed-by="taxItems">
<join-column name="invoice_id" nullable="false" on-delete="CASCADE" />
</many-to-one>
</entity>
</mapped-superclass>
</doctrine-mapping>
Empty file.