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

Reflect Sylius 2.0 Changes #325

Merged
merged 8 commits into from
Oct 23, 2024
Merged
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
24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,9 @@ Symfony Flex, it's much quicker! :)

## Extension points

Majority of actions contained in SyliusInvoicingPlugin is executed once an event after changing the state of the Order.
The majority of actions contained in the SyliusInvoicingPlugin are executed after an event related to the change of the Order’s state.

Here is the example for `Winzou State Machine`:

```yaml
winzou_state_machine:
sylius_payment:
callbacks:
after:
sylius_invoicing_plugin_payment_complete_producer:
on: ['complete']
do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke']
args: ['object']
```

Code placed above is a part of configuration placed in `config.yml` file.
You can customize this file by adding new state machine events listeners or editing existing ones.

Here is the example for Symfony's `workflow`:
Here is an example using Symfony’s workflow:

```xml
<service id="sylius_invoicing_plugin.event_listener.workflow.payment.produce_order_payment_paid"
Expand All @@ -106,13 +90,13 @@ Here is the example for Symfony's `workflow`:
</service>
```

Apart from that an Invoice model is treated as a Resource.
Additionally, the Invoice model is treated as a Resource.

You can read more about Resources here:

<http://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusResourceBundle/index.html>.

Hence, template for displaying the list of Invoices is defined in `routing.yml` file:
Hence, the template for displaying the list of Invoices is defined in the `routing.yml` file:

```yaml
sylius_invoicing_plugin_invoice:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"symfony/flex": true,
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": true,
"symfony/thanks": false
"symfony/thanks": false,
"php-http/discovery": false
}
},
"extra": {
Expand Down
Binary file modified docs/screenshot_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
Sylius\Bundle\CoreBundle\SyliusCoreBundle::class => ['all' => true],
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Expand Down Expand Up @@ -58,5 +57,6 @@
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true]
Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
];
10 changes: 10 additions & 0 deletions tests/Application/config/packages/http_discovery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory'

http_discovery.psr17_factory:
class: Http\Discovery\Psr17Factory
28 changes: 16 additions & 12 deletions tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ security:
context: admin
pattern: "%sylius.security.admin_regex%"
provider: sylius_admin_user_provider
user_checker: security.user_checker.chain.admin
form_login:
provider: sylius_admin_user_provider
login_path: sylius_admin_login
Expand All @@ -38,26 +39,28 @@ security:
path: sylius_admin_logout
target: sylius_admin_login

new_api_admin_user:
pattern: "%sylius.security.new_api_admin_regex%/.*"
api_admin:
pattern: "%sylius.security.api_admin_regex%/.*"
provider: sylius_api_admin_user_provider
user_checker: security.user_checker.chain.api_admin
stateless: true
entry_point: jwt
json_login:
check_path: "%sylius.security.new_api_admin_route%/administrators/token"
check_path: "%sylius.security.api_admin_route%/administrators/token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
jwt: true

new_api_shop_user:
pattern: "%sylius.security.new_api_shop_regex%/.*"
api_shop:
pattern: "%sylius.security.api_shop_regex%/.*"
provider: sylius_api_shop_user_provider
user_checker: security.user_checker.chain.api_shop
stateless: true
entry_point: jwt
json_login:
check_path: "%sylius.security.new_api_shop_route%/customers/token"
check_path: "%sylius.security.api_shop_route%/customers/token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
Expand All @@ -69,6 +72,7 @@ security:
context: shop
pattern: "%sylius.security.shop_regex%"
provider: sylius_shop_user_provider
user_checker: security.user_checker.chain.shop
form_login:
success_handler: sylius.authentication.success_handler
failure_handler: sylius.authentication.failure_handler
Expand Down Expand Up @@ -118,9 +122,9 @@ security:
- { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS }
- { path: "%sylius.security.shop_regex%/account", role: ROLE_USER }

- { path: "%sylius.security.new_api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.api_admin_route%/administrators/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_shop_account_regex%/.*", role: ROLE_USER }
- { path: "%sylius.security.api_shop_route%/customers/token", role: PUBLIC_ACCESS }
- { path: "%sylius.security.api_shop_regex%/.*", role: PUBLIC_ACCESS }
2 changes: 1 addition & 1 deletion tests/Application/config/routes/sylius_api.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sylius_api:
resource: "@SyliusApiBundle/Resources/config/routing.yml"
prefix: "%sylius.security.new_api_route%"
prefix: "%sylius.security.api_route%"
7 changes: 4 additions & 3 deletions tests/Application/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"license": "MIT",
"dependencies": {
"@sylius-ui/admin": "file:../../vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle",
"@sylius-ui/shop": "file:../../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle",
Expand All @@ -7,14 +8,14 @@
},
"devDependencies": {
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@symfony/webpack-encore": "^5.0.1",
"sass": "^1.54.8",
"sass-loader": "^13.0.0",
"sass-loader": "^16.0.2",
"tom-select": "^2.2.2"
},
"engines": {
"node": "^20"
"node": "^20 || ^22"
},
"license": "MIT",
"scripts": {
"build": "encore dev",
"build:prod": "encore production",
Expand Down
Loading