Default order by in to-many associations

This commit is contained in:
Kevin Kaniaburka 2022-12-22 09:43:22 +01:00
parent af5ad175f8
commit 6b1eefc1a0
No known key found for this signature in database
GPG key ID: 8DB4C54474F3FD72
29 changed files with 155 additions and 11 deletions

View file

@ -30,7 +30,8 @@
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="name" direction="ASC" />
<order-by-field name="name" />
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>

View file

@ -27,6 +27,9 @@
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>

View file

@ -17,6 +17,10 @@
>
<mapped-superclass name="Sylius\Component\Core\Model\CatalogPromotion" table="sylius_catalog_promotion">
<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_catalog_promotion_channels">
<join-columns>
<join-column name="catalog_promotion_id" nullable="false" on-delete="CASCADE" />

View file

@ -38,6 +38,10 @@
<join-column name="menu_taxon_id" referenced-column-name="id" nullable="true" on-delete="SET NULL" />
</many-to-one>
<many-to-many field="currencies" target-entity="Sylius\Component\Currency\Model\CurrencyInterface" fetch="EAGER">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_channel_currencies">
<join-columns>
<join-column name="channel_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />

View file

@ -34,6 +34,10 @@
</field>
<field name="channelCode" column="channel_code" type="string" />
<many-to-many field="appliedPromotions" target-entity="Sylius\Component\Promotion\Model\CatalogPromotionInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_channel_pricing_catalog_promotions">
<join-columns>
<join-column name="channel_pricing_id" nullable="false"/>

View file

@ -31,11 +31,19 @@
</one-to-one>
<one-to-many field="orders" target-entity="Sylius\Component\Order\Model\OrderInterface" mapped-by="customer">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all />
</cascade>
</one-to-many>
<one-to-many field="addresses" target-entity="Sylius\Component\Addressing\Model\AddressInterface" mapped-by="customer">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all />
</cascade>

View file

@ -46,12 +46,20 @@
</many-to-one>
<one-to-many field="payments" target-entity="Sylius\Component\Payment\Model\PaymentInterface" mapped-by="order" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
<one-to-many field="shipments" target-entity="Sylius\Component\Shipping\Model\ShipmentInterface" mapped-by="order" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>
@ -65,6 +73,10 @@
</many-to-one>
<many-to-many field="promotions" target-entity="Sylius\Component\Promotion\Model\PromotionInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_promotion_order">
<join-columns>
<join-column name="order_id" referenced-column-name="id" on-delete="CASCADE" />

View file

@ -18,6 +18,10 @@
<mapped-superclass name="Sylius\Component\Core\Model\PaymentMethod" table="sylius_payment_method">
<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_payment_method_channels">
<join-columns>
<join-column name="payment_method_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />

View file

@ -26,12 +26,20 @@
</field>
<one-to-many field="productTaxons" target-entity="Sylius\Component\Core\Model\ProductTaxonInterface" mapped-by="product" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_product_channels">
<join-columns>
<join-column name="product_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
@ -47,6 +55,10 @@
</many-to-one>
<one-to-many field="images" target-entity="Sylius\Component\Core\Model\ProductImageInterface" mapped-by="owner" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>

View file

@ -17,6 +17,10 @@
<join-column name="owner_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</many-to-one>
<many-to-many field="productVariants" target-entity="Sylius\Component\Product\Model\ProductVariantInterface" inversed-by="images">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_product_image_product_variants">
<join-columns>
<join-column name="image_id" referenced-column-name="id" on-delete="CASCADE" />

View file

@ -39,6 +39,10 @@
orphan-removal="true"
index-by="channelCode"
>
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>
@ -48,6 +52,10 @@
target-entity="Sylius\Component\Core\Model\ProductImageInterface"
mapped-by="productVariants"
>
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-persist/>
</cascade>

View file

@ -19,6 +19,10 @@
<mapped-superclass name="Sylius\Component\Core\Model\Promotion" table="sylius_promotion">
<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_promotion_channels">
<join-columns>
<join-column name="promotion_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />

View file

@ -20,6 +20,10 @@
<field name="adjustmentsTotal" column="adjustments_total" type="integer" />
<one-to-many field="adjustments" target-entity="Sylius\Component\Core\Model\AdjustmentInterface" mapped-by="shipment" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>

View file

@ -26,6 +26,10 @@
</many-to-one>
<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_shipping_method_channels">
<join-columns>
<join-column name="shipping_method_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />

View file

@ -26,6 +26,10 @@
</field>
<one-to-many field="images" target-entity="Sylius\Component\Core\Model\TaxonImageInterface" mapped-by="owner" orphan-removal="true">
<order-by>
<order-by-field name="id" />
</order-by>
<cascade>
<cascade-all/>
</cascade>

View file

@ -33,12 +33,18 @@
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="adjustments" target-entity="Sylius\Component\Order\Model\AdjustmentInterface" mapped-by="order" orphan-removal="true">
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="itemsTotal" column="items_total" type="integer" />

View file

@ -37,12 +37,18 @@
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="units" target-entity="Sylius\Component\Order\Model\OrderItemUnitInterface" mapped-by="orderItem" orphan-removal="true">
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>

View file

@ -31,6 +31,9 @@
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>

View file

@ -24,6 +24,9 @@
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="variants" target-entity="Sylius\Component\Product\Model\ProductVariantInterface" mapped-by="product" orphan-removal="true">
@ -31,7 +34,8 @@
<cascade-all />
</cascade>
<order-by>
<order-by-field name="position" direction="ASC" />
<order-by-field name="position" />
<order-by-field name="id" />
</order-by>
</one-to-many>
@ -40,7 +44,8 @@
<cascade-persist />
</cascade>
<order-by>
<order-by-field name="position" direction="ASC" />
<order-by-field name="position" />
<order-by-field name="id" />
</order-by>
<join-table name="sylius_product_options">
<join-columns>
@ -52,6 +57,15 @@
</join-table>
</many-to-many>
<one-to-many field="associations" target-entity="Sylius\Component\Product\Model\ProductAssociationInterface" mapped-by="owner" orphan-removal="true">
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="createdAt" column="created_at" type="datetime">
<gedmo:timestampable on="create"/>
</field>
@ -60,12 +74,6 @@
<gedmo:timestampable on="update"/>
</field>
<field name="enabled" column="enabled" type="boolean" />
<one-to-many field="associations" target-entity="Sylius\Component\Product\Model\ProductAssociationInterface" mapped-by="owner" orphan-removal="true">
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
</mapped-superclass>
</doctrine-mapping>

View file

@ -43,6 +43,10 @@
</many-to-one>
<many-to-many field="associatedProducts" target-entity="Sylius\Component\Product\Model\ProductInterface">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_product_association_product">
<join-columns>
<join-column name="association_id" referenced-column-name="id" nullable="false" unique="false" on-delete="CASCADE" />

View file

@ -36,7 +36,12 @@
</field>
<one-to-many target-entity="Sylius\Component\Product\Model\ProductOptionValueInterface" mapped-by="option" field="values" orphan-removal="true">
<cascade><cascade-all /></cascade>
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>

View file

@ -38,6 +38,10 @@
</many-to-one>
<many-to-many target-entity="Sylius\Component\Product\Model\ProductOptionValueInterface" field="optionValues">
<order-by>
<order-by-field name="id" />
</order-by>
<join-table name="sylius_product_variant_option_value">
<join-columns>
<join-column name="variant_id" referenced-column-name="id" unique="false" nullable="false" on-delete="CASCADE" />

View file

@ -39,11 +39,17 @@
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="actions" target-entity="Sylius\Component\Promotion\Model\CatalogPromotionActionInterface" mapped-by="catalogPromotion" orphan-removal="true">
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>
</doctrine-mapping>

View file

@ -39,16 +39,25 @@
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="rules" target-entity="Sylius\Component\Promotion\Model\PromotionRuleInterface" mapped-by="promotion" orphan-removal="true">
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<one-to-many field="actions" target-entity="Sylius\Component\Promotion\Model\PromotionActionInterface" mapped-by="promotion" orphan-removal="true">
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="createdAt" column="created_at" type="datetime">

View file

@ -30,6 +30,9 @@
<cascade>
<cascade-persist/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="createdAt" column="created_at" type="datetime">

View file

@ -27,6 +27,9 @@
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="categoryRequirement" column="category_requirement" type="integer" />

View file

@ -28,6 +28,9 @@
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
<field name="createdAt" column="created_at" type="datetime">

View file

@ -37,7 +37,8 @@
<cascade-persist />
</cascade>
<order-by>
<order-by-field name="position" direction="ASC" />
<order-by-field name="position" />
<order-by-field name="id" />
</order-by>
</one-to-many>

View file

@ -47,6 +47,9 @@
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="id" />
</order-by>
</one-to-many>
</mapped-superclass>
</doctrine-mapping>