Skip to content

Commit

Permalink
Turn resources from entity to mapped-superclass & cascade deletions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobTolkemit authored Jul 27, 2023
1 parent 6af4976 commit fdd9d66
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

<field name="name" nullable="true"/>

<many-to-one target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionGroupInterface" field="translatable" inversed-by="translations"/>
<many-to-one target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionGroupInterface" field="translatable" inversed-by="translations">
<join-column on-delete="CASCADE"/>
</many-to-one>
</mapped-superclass>
</doctrine-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<field name="name" nullable="true"/>

<many-to-one target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionInterface" field="translatable" inversed-by="translations"/>
<many-to-one target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionInterface" field="translatable" inversed-by="translations">
<join-column on-delete="CASCADE"/>
</many-to-one>
</mapped-superclass>
</doctrine-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionInterface"
field="customerOption"
inversed-by="values"
/>
>
<join-column on-delete="CASCADE"/>
</many-to-one>

<!-- Constraints -->
<unique-constraints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<cascade>
<cascade-persist/>
</cascade>
<join-column on-delete="CASCADE"/>
</many-to-one>

<many-to-one
Expand All @@ -28,7 +29,9 @@
</many-to-one>

<many-to-one target-entity="Sylius\Component\Product\Model\ProductInterface"
field="product" inversed-by="customerOptionValuePrices" />
field="product" inversed-by="customerOptionValuePrices">
<join-column on-delete="CASCADE"/>
</many-to-one>

<one-to-one field="dateValid" target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\Tools\DateRange">
<cascade>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<entity
<mapped-superclass
name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\Condition"
table="brille24_customer_option_group_validator_condition"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<entity
<mapped-superclass
name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\Constraint"
table="brille24_customer_option_group_validator_constraint"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<entity name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\ErrorMessage"
<mapped-superclass name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\ErrorMessage"
table="brille24_validator_error_message"
>
<id name="id" type="integer">
Expand All @@ -10,5 +10,5 @@
<join-column on-delete="CASCADE"/>
</one-to-one>

</entity>
</mapped-superclass>
</doctrine-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
>
<entity
<mapped-superclass
name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\ErrorMessageTranslation"
table="brille24_validator_error_message_translation"
>
Expand All @@ -19,5 +19,5 @@
>
<join-column on-delete="CASCADE" />
</many-to-one>
</entity>
</mapped-superclass>
</doctrine-mapping>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<entity
<mapped-superclass
name="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\Validator\Validator"
table="brille24_customer_option_group_validator"
>
Expand Down Expand Up @@ -40,6 +40,8 @@
target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\CustomerOptions\CustomerOptionGroupInterface"
field="customerOptionGroup"
inversed-by="validators"
/>
</entity>
>
<join-column on-delete="CASCADE"/>
</many-to-one>
</mapped-superclass>
</doctrine-mapping>
8 changes: 5 additions & 3 deletions src/Resources/config/doctrine/OrderItemOption.orm.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
<entity name="Brille24\SyliusCustomerOptionsPlugin\Entity\OrderItemOption"
<mapped-superclass name="Brille24\SyliusCustomerOptionsPlugin\Entity\OrderItemOption"
table="brille24_customer_option_order_item_option">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>

<many-to-one target-entity="Sylius\Component\Order\Model\OrderItemInterface" field="orderItem" inversed-by="configuration"/>
<many-to-one target-entity="Sylius\Component\Order\Model\OrderItemInterface" field="orderItem" inversed-by="configuration">
<join-column on-delete="CASCADE"/>
</many-to-one>

<field name="customerOptionCode"/>
<field name="customerOptionName"/>
Expand Down Expand Up @@ -36,5 +38,5 @@
<field name="fixedPrice" type="integer"/>
<field name="percent" type="float" />
<field name="pricingType" type="string" />
</entity>
</mapped-superclass>
</doctrine-mapping>

0 comments on commit fdd9d66

Please sign in to comment.