Skip to content

Commit

Permalink
OP-289: Reformat configs for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
hmfilar committed Aug 22, 2024
1 parent 208659e commit 3037837
Show file tree
Hide file tree
Showing 74 changed files with 489 additions and 455 deletions.
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ This **open-source plugin was developed to help the Sylius community**. If you h
# config/packages/_sylius.yaml
imports:
...
...
- { resource: "@BitBagSyliusProductBundlePlugin/Resources/config/config.yml" }
- { resource: "@BitBagSyliusProductBundlePlugin/Resources/config/config.yml" }
```
4. (optional) Import routing in your `config/routes.yaml` file:
Expand All @@ -78,7 +78,7 @@ This **open-source plugin was developed to help the Sylius community**. If you h
...
bitbag_sylius_product_bundle_plugin:
resource: "@BitBagSyliusProductBundlePlugin/Resources/config/routing.yml"
resource: "@BitBagSyliusProductBundlePlugin/Resources/config/routing.yml"
```
5. Extend `Product`(including Doctrine mapping):
Expand Down Expand Up @@ -231,16 +231,16 @@ This **open-source plugin was developed to help the Sylius community**. If you h
# config/packages/_sylius.yaml
sylius_product:
resources:
product:
classes:
model: App\Entity\Product\Product
sylius_order:
resources:
order_item:
classes:
model: App\Entity\Order\OrderItem
resources:
product:
classes:
model: App\Entity\Product\Product
sylius_order:
resources:
order_item:
classes:
model: App\Entity\Order\OrderItem
```
Expand All @@ -249,16 +249,16 @@ This **open-source plugin was developed to help the Sylius community**. If you h
```yaml
# config/packages/doctrine.yaml
doctrine:
orm:
entity_managers:
default:
mappings:
App:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/src/Resources/config/doctrine'
prefix: 'App\Entity'
alias: App
orm:
entity_managers:
default:
mappings:
App:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/src/Resources/config/doctrine'
prefix: 'App\Entity'
alias: App
```
Expand Down
47 changes: 26 additions & 21 deletions src/Resources/config/api_resources/Order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
<attribute name="groups">shop:order:create</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Pickups a new cart. Provided locale code has to be one of available for a particular channel.</attribute> </attribute>
<attribute name="summary">Pickups a new cart. Provided locale code has to be one of available for a
particular channel.
</attribute>
</attribute>
</collectionOperation>

<collectionOperation name="shop_get">
Expand Down Expand Up @@ -137,7 +140,9 @@
<attribute name="groups">shop:cart:read</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Addresses cart to given location, logged in Customer does not have to provide an email</attribute>
<attribute name="summary">Addresses cart to given location, logged in Customer does not have to
provide an email
</attribute>
</attribute>
</itemOperation>

Expand Down Expand Up @@ -414,33 +419,33 @@
</subresourceOperation>
</subresourceOperations>

<property name="id" identifier="false" writable="false" />
<property name="number" identifier="false" writable="false" />
<property name="tokenValue" identifier="true" writable="false" />
<property name="channel" writable="false" />
<property name="customer" writable="false" />
<property name="id" identifier="false" writable="false"/>
<property name="number" identifier="false" writable="false"/>
<property name="tokenValue" identifier="true" writable="false"/>
<property name="channel" writable="false"/>
<property name="customer" writable="false"/>
<property name="shipments" writable="false">
<subresource resourceClass="%sylius.model.shipment.class%" />
<subresource resourceClass="%sylius.model.shipment.class%"/>
</property>
<property name="payments" writable="false">
<subresource resourceClass="%sylius.model.payment.class%" />
<subresource resourceClass="%sylius.model.payment.class%"/>
</property>
<property name="state" writable="false" />
<property name="paymentState" writable="false" />
<property name="shippingState" writable="false" />
<property name="total" writable="false" />
<property name="orderPromotionTotal" writable="false" />
<property name="state" writable="false"/>
<property name="paymentState" writable="false"/>
<property name="shippingState" writable="false"/>
<property name="total" writable="false"/>
<property name="orderPromotionTotal" writable="false"/>
<property name="items" readable="true" writable="true">
<subresource resourceClass="%sylius.model.order_item.class%" />
<subresource resourceClass="%sylius.model.order_item.class%"/>
</property>
<property name="notes" writable="true" />
<property name="itemsTotal" readable="true" />
<property name="notes" writable="true"/>
<property name="itemsTotal" readable="true"/>
<property name="taxTotal" readable="true"/>
<property name="adjustments" writable="false">
<subresource resourceClass="%sylius.model.adjustment.class%" />
<subresource resourceClass="%sylius.model.adjustment.class%"/>
</property>
<property name="billingAddress" writable="false" />
<property name="shippingAddress" writable="false" />
<property name="localeCode" writable="true" />
<property name="billingAddress" writable="false"/>
<property name="shippingAddress" writable="false"/>
<property name="localeCode" writable="true"/>
</resource>
</resources>
26 changes: 13 additions & 13 deletions src/Resources/config/api_resources/Product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
</subresourceOperation>
</subresourceOperations>

<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />
<property name="createdAt" writable="false" />
<property name="updatedAt" writable="false" />
<property name="id" identifier="false" writable="false"/>
<property name="code" identifier="true" required="true"/>
<property name="createdAt" writable="false"/>
<property name="updatedAt" writable="false"/>
<property name="translations" readable="true" writable="true">
<attribute name="openapi_context">
<attribute name="type">object</attribute>
Expand All @@ -115,17 +115,17 @@
</attribute>
</attribute>
</property>
<property name="productTaxons" readable="true" writable="true" />
<property name="reviews" required="false" />
<property name="options" required="false" />
<property name="channels" required="false" />
<property name="images" required="false" />
<property name="mainTaxon" required="false" />
<property name="productTaxons" readable="true" writable="true"/>
<property name="reviews" required="false"/>
<property name="options" required="false"/>
<property name="channels" required="false"/>
<property name="images" required="false"/>
<property name="mainTaxon" required="false"/>
<property name="variants" readable="true"/>
<property name="averageRating" readable="true" />
<property name="averageRating" readable="true"/>
<property name="productBundle" writable="false">
<subresource resourceClass="%bitbag_sylius_product_bundle.model.product_bundle.class%" collection="false" />
<subresource resourceClass="%bitbag_sylius_product_bundle.model.product_bundle.class%" collection="false"/>
</property>
<property name="bundle" writable="false" />
<property name="bundle" writable="false"/>
</resource>
</resources>
3 changes: 2 additions & 1 deletion src/Resources/config/api_resources/ProductBundle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
<attribute name="path">/shop/product-bundles/{id}/add-to-cart</attribute>
<attribute name="status">200</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand</attribute>
<attribute name="input">BitBag\SyliusProductBundlePlugin\Command\AddProductBundleToCartCommand
</attribute>
<attribute name="output">false</attribute>
<attribute name="denormalization_context">
<attribute name="groups">
Expand Down
12 changes: 6 additions & 6 deletions src/Resources/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
imports:
- { resource: resources.yml }
- { resource: grids.yml }
- { resource: services.xml }
- { resource: resources.yml }
- { resource: grids.yml }
- { resource: services.xml }

framework:
messenger:
buses:
bitbag_sylius_product_bundle.command_bus: ~
messenger:
buses:
bitbag_sylius_product_bundle.command_bus: ~
6 changes: 3 additions & 3 deletions src/Resources/config/resources.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
imports:
- { resource: resources/product_bundle.yml }
- { resource: resources/product_bundle_item.yml }
- { resource: resources/product_bundle_order_item.yml }
- { resource: resources/product_bundle.yml }
- { resource: resources/product_bundle_item.yml }
- { resource: resources/product_bundle_order_item.yml }
16 changes: 8 additions & 8 deletions src/Resources/config/resources/product_bundle.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
sylius_resource:
resources:
bitbag_sylius_product_bundle.product_bundle:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundle
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleInterface
form: BitBag\SyliusProductBundlePlugin\Form\Type\ProductBundleType
repository: BitBag\SyliusProductBundlePlugin\Repository\ProductBundleRepository
resources:
bitbag_sylius_product_bundle.product_bundle:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundle
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleInterface
form: BitBag\SyliusProductBundlePlugin\Form\Type\ProductBundleType
repository: BitBag\SyliusProductBundlePlugin\Repository\ProductBundleRepository
14 changes: 7 additions & 7 deletions src/Resources/config/resources/product_bundle_item.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sylius_resource:
resources:
bitbag_sylius_product_bundle.product_bundle_item:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItem
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface
form: BitBag\SyliusProductBundlePlugin\Form\Type\ProductBundleItemType
resources:
bitbag_sylius_product_bundle.product_bundle_item:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItem
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleItemInterface
form: BitBag\SyliusProductBundlePlugin\Form\Type\ProductBundleItemType
12 changes: 6 additions & 6 deletions src/Resources/config/resources/product_bundle_order_item.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sylius_resource:
resources:
bitbag_sylius_product_bundle.product_bundle_order_item:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItem
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface
resources:
bitbag_sylius_product_bundle.product_bundle_order_item:
driver: doctrine/orm
classes:
model: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItem
interface: BitBag\SyliusProductBundlePlugin\Entity\ProductBundleOrderItemInterface
8 changes: 4 additions & 4 deletions src/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bitbag_sylius_product_bundle_admin:
resource: routing/admin.yml
prefix: /admin
resource: routing/admin.yml
prefix: /admin

bitbag_sylius_product_bundle_shop:
resource: routing/shop.yml
prefix: /{_locale}
resource: routing/shop.yml
prefix: /{_locale}
92 changes: 46 additions & 46 deletions src/Resources/config/routing/admin.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
bitbag_product_bundle_admin_product_create_bundle:
path: /products/new/bundle
methods: [GET, POST]
defaults:
_controller: sylius.controller.product::createAction
_sylius:
section: admin
permission: true
factory:
method: createWithVariantAndBundle
template: "@SyliusAdmin/Crud/create.html.twig"
redirect: sylius_admin_product_update
form:
options:
validation_groups:
- sylius
- bitbag_sylius_product_bundle
vars:
subheader: sylius.ui.manage_your_product_catalog
templates:
form: "@SyliusAdmin/Product/_form.html.twig"
route:
name: bitbag_product_bundle_admin_product_create_bundle
path: /products/new/bundle
methods: [ GET, POST ]
defaults:
_controller: sylius.controller.product::createAction
_sylius:
section: admin
permission: true
factory:
method: createWithVariantAndBundle
template: "@SyliusAdmin/Crud/create.html.twig"
redirect: sylius_admin_product_update
form:
options:
validation_groups:
- sylius
- bitbag_sylius_product_bundle
vars:
subheader: sylius.ui.manage_your_product_catalog
templates:
form: "@SyliusAdmin/Product/_form.html.twig"
route:
name: bitbag_product_bundle_admin_product_create_bundle

bitbag_product_bundle_admin_ajax_product_variants_by_phrase:
path: /ajax/product-variants/search-by-phrase
methods: [GET]
defaults:
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
serialization_groups: [Autocomplete]
permission: true
repository:
method: findByPhrase
arguments:
phrase: $phrase
locale: expr:service('sylius.context.locale').getLocaleCode()
path: /ajax/product-variants/search-by-phrase
methods: [ GET ]
defaults:
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
serialization_groups: [ Autocomplete ]
permission: true
repository:
method: findByPhrase
arguments:
phrase: $phrase
locale: expr:service('sylius.context.locale').getLocaleCode()

bitbag_product_bundle_admin_ajax_product_variants_by_codes:
path: /ajax/product-variants/by-codes
methods: [GET]
defaults:
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
serialization_groups: [Autocomplete]
permission: true
repository:
method: findByCodes
arguments: [$code]
path: /ajax/product-variants/by-codes
methods: [ GET ]
defaults:
_controller: sylius.controller.product_variant::indexAction
_format: json
_sylius:
serialization_groups: [ Autocomplete ]
permission: true
repository:
method: findByCodes
arguments: [ $code ]
Loading

0 comments on commit 3037837

Please sign in to comment.