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

OP-558: Sylius 2 upgrade #71

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 5 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1", "8.2", "8.3"]
symfony: ["^5.4", "^6.4"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["^18.0", "^20.0"]
php: [ "8.2", "8.3" ]
symfony: [ "^6.4" ]
sylius: [ "~v2.0.0-alpha.2" ]
node: [ "20.x" ]
mysql: ["8.0"]
exclude:
- sylius: "~1.13.0"
php: "8.0"
- sylius: "~1.12.0"
php: "8.0"
symfony: "^6.4"

env:
APP_ENV: test
Expand Down Expand Up @@ -182,7 +176,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.0", "8.1", "8.2", "8.3" ]
symfony: [ "^5.4", "^6.4" ]
sylius: [ "^1.12", "^1.13" ]
node: [ "18.x", "20.x" ]

exclude:
- sylius: ^1.13
php: 8.0
- sylius: ^1.12
php: 8.0
symfony: ^6.4
php: [ "8.2", "8.3" ]
symfony: [ "^6.4" ]
sylius: [ "~v2.0.0-alpha.2" ]
node: [ "20.x" ]

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/behat.yml
/phpspec.yml
/phpunit.xml
.idea
File renamed without changes.
File renamed without changes.
74 changes: 45 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,56 @@
"description": "Blacklist plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^8.0 || ^8.1 || ^8.2 || ^8.3",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"doctrine/annotations": "^2.0.0"
"php": "^8.2",
"dompdf/dompdf": "^2.0",
"sylius-labs/polyfill-symfony-security": "^1.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"sylius-labs/polyfill-symfony-security": "^1.1",

"sylius/calendar": "^0.5.0",
"sylius/grid-bundle": "^1.13.0",
"sylius/sylius": "~2.0",
"sylius/twig-extra": "^0.5",
"sylius/twig-hooks": "^0.5",
"symfony/stimulus-bundle": "^2.12",
"symfony/ux-autocomplete": "^2.17",
"symfony/ux-live-component": "^2.20",
"symfony/ux-twig-component": "^2.20",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/workflow": "^7.2",
"willdurand/hateoas-bundle": "2.5.0"
},
"require-dev": {
"behat/behat": "^3.7.0",
"behat/mink": "^1.8",
"behat/mink-selenium2-driver": "~1.6.0",
"behat/behat": "^3.14",
"behat/mink-selenium2-driver": "^1.7",
"bitbag/coding-standard": "^3.0.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.4",
"dmore/behat-chrome-extension": "^1.4",
"friends-of-behat/mink": "^1.11",
"friends-of-behat/mink-browserkit-driver": "^1.6",
"friends-of-behat/mink-debug-extension": "^2.1",
"friends-of-behat/mink-extension": "^2.7",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lchrusciel/api-test-case": "^4.1||^5.0",
"friends-of-behat/suite-settings-extension": "^1.1",
"friends-of-behat/symfony-extension": "^2.6",
"friends-of-behat/variadic-extension": "^1.6",
"gedmo/doctrine-extensions": "^3.9",
"lchrusciel/api-test-case": "^4.1 || ^5.0",
"league/flysystem-bundle": "^3.3",
"nelmio/alice": "^3.10",
"nyholm/psr7": "^1.8",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/browser-kit": "^5.4 || 6.4",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
"symfony/intl": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
"vimeo/psalm": "^4.7 || ^5.0",
"symfony/webpack-encore-bundle": "^1.17"
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.4",
"sylius-labs/suite-tags-extension": "~0.2",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
"sylius/sylius-rector": "^2.0",
"symfony/browser-kit": "^6.4 || ^7.1",
"symfony/debug-bundle": "^6.4 || ^7.1",
"symfony/dependency-injection": "^6.4 || ^7.1",
"symfony/dotenv": "^6.4 || ^7.1",
"symfony/http-client": "^6.4 || ^7.1",
"symfony/intl": "^6.4 || ^7.1",
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
"symfony/profiler-pack": "^1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -56,7 +71,8 @@
"symfony/thanks": true,
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": true
}
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/config.yaml → config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
imports:
- { resource: "twig_hooks/**/*.yaml" }
- { resource: "resources.yaml" }
- { resource: "services.xml" }
- { resource: "grids.yaml" }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ sylius_grid:
type: delete
main:
create:
type: create
type: create
File renamed without changes.
7 changes: 7 additions & 0 deletions config/routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bitbag_sylius_blacklist_plugin_admin:
resource: "@BitBagSyliusBlacklistPlugin/config/routing/admin.yaml"
prefix: /admin

bitbag_sylius_blacklist_plugin_shop:
resource: "@BitBagSyliusBlacklistPlugin/config/routing/shop.yaml"
prefix: /{_locale}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ bitbag_sylius_blacklist_plugin_admin_automatic_blacklisting_configuration:
resource: |
alias: bitbag_sylius_blacklist_plugin.automatic_blacklisting_configuration
section: admin
templates: "@SyliusAdmin\\Crud"
templates: "@SyliusAdmin\\shared\\crud"
grid: bitbag_sylius_blacklist_plugin_automatic_blacklisting_configuration
except: ['show']
permission: true
form:
type: BitBag\SyliusBlacklistPlugin\Form\Type\AutomaticBlacklistingConfigurationType
vars:
all:
subheader: bitbag_sylius_blacklist_plugin.ui.configure_automatic_blacklisting_configurations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bitbag_sylius_blacklist_plugin_admin_blacklisting_rule:
resource: |
alias: bitbag_sylius_blacklist_plugin.blacklisting_rule
section: admin
templates: "@SyliusAdmin\\Crud"
templates: "@SyliusAdmin\\shared\\crud"
grid: bitbag_sylius_blacklist_plugin_blacklisting_rule
except: ['show']
permission: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bitbag_sylius_blacklist_plugin_admin_fraud_suspicion:
resource: |
alias: bitbag_sylius_blacklist_plugin.fraud_suspicion
section: admin
templates: "@SyliusAdmin\\Crud"
templates: "@SyliusAdmin\\shared\\crud"
grid: bitbag_sylius_blacklist_plugin_fraud_suspicion
permission: true
vars:
Expand All @@ -12,7 +12,7 @@ bitbag_sylius_blacklist_plugin_admin_fraud_suspicion:
icon: clipboard list
type: sylius.resource

bitbag_sylius_blacklist_plugin_admin_fraud_suspicion_show:
sylius_admin_fraud_suspicion_show:
path: fraud-suspicions/{id}
methods: [GET]
defaults:
Expand All @@ -34,8 +34,7 @@ bitbag_sylius_blacklist_plugin_admin_order_mark_suspicious:
parameters:
orderId: $orderId
section: admin
template: "@SyliusAdmin/Crud/create.html.twig"
form: BitBag\SyliusBlacklistPlugin\Form\Type\FraudSuspicionOrderType
template: "@SyliusAdmin/shared/crud/create.html.twig"
factory:
method: createForOrder
arguments:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
</service>

<service id="sylius.form.type.checkout_address" class="Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressType">
<argument type="service" id="sylius.address_comparator" />
<argument>%sylius.model.order.class%</argument>
<argument>%bitbag.sylius_blacklist_plugin.form.type.checkout_address.validation_groups%</argument>
<argument type="service" id="sylius.address_comparator" />
<tag name="form.type" />
</service>

<service id="bitbag.sylius_blacklist_plugin.form.type.automatic_blacklisting_configuration"
class="BitBag\SyliusBlacklistPlugin\Form\Type\AutomaticBlacklistingConfigurationType">
<argument>%bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%</argument>
<argument>%bitbag_sylius_blacklist_plugin.model.automatic_blacklisting_configuration.class%</argument>
<argument>%bitbag.sylius_blacklist_plugin.form.type.automatic_blacklisting_configuration.validation_groups%</argument>
<argument>%bitbag.sylius_blacklist_plugin.form.type.validation_groups%</argument>
<tag name="form.type" />
</service>
Expand All @@ -69,5 +69,10 @@
<argument>%bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%</argument>
<tag name="form.type" />
</service>
<service id="bitbag.sylius_blacklist_plugin.form.type.customer_autocomplete" class="BitBag\SyliusBlacklistPlugin\Form\Type\CustomerAutocompleteType" >
<argument>%sylius.model.customer.class%</argument>
<tag name="form.type" />
<tag name="ux.entity_autocomplete_field" />
</service>
</services>
</container>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
>
<services>
<service id="bitbag.sylius_blacklist_plugin.state_resolver.customer" class="BitBag\SyliusBlacklistPlugin\StateResolver\CustomerStateResolver">
<argument type="service" id="sm.factory" />
<argument type="service" id="sylius.manager.customer" />
<!-- <argument type="service" id="sm.factory" />-->
<!-- <argument type="service" id="sylius.manager.customer" />-->
</service>
</services>
</container>
56 changes: 56 additions & 0 deletions config/services/twig/component.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>

<container
xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<service
id="bitbag_sylius_blacklist_plugin.twig.component.automatic_blacklisting_configuration.form"
class="Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent"
>
<argument type="service" id="bitbag_sylius_blacklist_plugin.repository.automatic_blacklisting_configuration" />
<argument type="service" id="form.factory" />
<argument>%bitbag_sylius_blacklist_plugin.model.automatic_blacklisting_configuration.class%</argument>
<argument>BitBag\SyliusBlacklistPlugin\Form\Type\AutomaticBlacklistingConfigurationType</argument>

<tag
name="sylius.live_component"
key="sylius_admin:automatic_blacklisting_configuration:form"
template="@BitBagSyliusBlacklistPlugin/AutomaticBlacklistingConfiguration/Admin/form.html.twig"
/>
</service>

<service
id="bitbag_sylius_blacklist_plugin.twig.component.blacklisting_rule.form"
class="Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent"
>
<argument type="service" id="bitbag_sylius_blacklist_plugin.repository.blacklisting_rule" />
<argument type="service" id="form.factory" />
<argument>%bitbag_sylius_blacklist_plugin.model.blacklisting_rule.class%</argument>
<argument>BitBag\SyliusBlacklistPlugin\Form\Type\BlacklistingRuleType</argument>

<tag
name="sylius.live_component"
key="sylius_admin:blacklisting_rule:form"
template="@BitBagSyliusBlacklistPlugin/BlacklistingRule/Admin/form.html.twig"
/>
</service>

<service
id="bitbag_sylius_blacklist_plugin.twig.component.fraud_suspicion.form"
class="Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponent"
>
<argument type="service" id="bitbag_sylius_blacklist_plugin.repository.fraud_suspicion" />
<argument type="service" id="form.factory" />
<argument>%bitbag_sylius_blacklist_plugin.model.fraud_suspicion.class%</argument>
<argument>BitBag\SyliusBlacklistPlugin\Form\Type\FraudSuspicionType</argument>

<tag name="sylius.live_component"
key="sylius_admin:fraud_suspicion:form"
template="@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/form.html.twig"
/>
</service>
</services>
</container>
15 changes: 15 additions & 0 deletions config/services/twig/extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>

<container
xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<service id="bitbag_sylius_blacklist_plugin.twig.extension.labels.automatic_blacklisting_configuration"
class="BitBag\SyliusBlacklistPlugin\Twig\AutomaticBlacklistingConfigurationLabelsExtension">
<argument>%bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%</argument>
<tag name="twig.extension"/>
</service>
</services>
</container>
File renamed without changes.
38 changes: 38 additions & 0 deletions config/state_machine/customer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#framework:
# workflows:
# bitbag_sylius_blacklist_plugin_customer_state_machine:
# type: state_machine
# marking_store:
# type: method
# property: getMarking # Metoda w Twojej encji odpowiedzialna za przechowywanie stanu
# supports:
# - App\Entity\Customer
# places:
# - active
# - inactive
# transitions:
# deactivate:
# from: active
# to: inactive
# activate:
# from: inactive
# to: active

# bitbag_sylius_blacklist_plugin_customer:
# class: "%sylius.model.customer.class%"
# property_path: fraudStatus
# graph: bitbag_sylius_blacklist_plugin_customer
# state_machine_class: "%sylius.state_machine.class%"
# states:
# neutral: ~
# blacklisted: ~
# transitions:
# neutralizing:
# from: [blacklisted]
# to: neutral
# blacklisting:
# from: [neutral]
# to: blacklisted
# whitelisting:
# from: [neutral]
# to: whitelisted
13 changes: 13 additions & 0 deletions config/twig_hooks/automatic_blacklisting_configuration/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sylius_twig_hooks:
hooks:
'sylius_admin.automatic_blacklisting_configuration.create.content':
form:
component: 'sylius_admin:automatic_blacklisting_configuration:form'
props:
resource: '@=_context.resource'
form: '@=_context.form'
configuration:
render_rest: false
'sylius_admin.automatic_blacklisting_configuration.create.content.form':
sections:
template: '@BitBagSyliusBlacklistPlugin/AutomaticBlacklistingConfiguration/Admin/form.html.twig'
Loading
Loading