Skip to content

Commit

Permalink
Make entities extendable
Browse files Browse the repository at this point in the history
  • Loading branch information
tautelis authored and bartoszpietrzak1994 committed Feb 8, 2019
1 parent 04e4db9 commit b1f716e
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 53 deletions.
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
15 changes: 8 additions & 7 deletions src/Entity/InvoiceShopBillingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@

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;

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>

0 comments on commit b1f716e

Please sign in to comment.