Skip to content

Commit daaf69f

Browse files
authored
Merge pull request #444 from loic425/feature/symfony-6
Add Symfony 6 support
2 parents 0738636 + 79e74f8 commit daaf69f

File tree

71 files changed

+537
-707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+537
-707
lines changed

.env

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
2525
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
2626
DATABASE_URL=mysql://[email protected]/monofony_%kernel.environment%
2727
###< doctrine/doctrine-bundle ###
28-
29-
###> symfony/swiftmailer-bundle ###
30-
# For Gmail as a transport, use: "gmail://username:password@localhost"
31-
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
32-
# Delivery is disabled by default via "null://localhost"
33-
MAILER_URL=null://localhost
34-
###< symfony/swiftmailer-bundle ###
35-
3628
###> nelmio/cors-bundle ###
3729
CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$
3830
###< nelmio/cors-bundle ###
@@ -52,3 +44,7 @@ JWT_SECRET_KEY=%kernel.project_dir%/src/Monofony/MetaPack/ApiMeta/.recipe/config
5244
JWT_PUBLIC_KEY=%kernel.project_dir%/src/Monofony/MetaPack/ApiMeta/.recipe/config/jwt/public.pem
5345
JWT_PASSPHRASE=c7485a94ceb933109daa3247b2bb2c69
5446
###< lexik/jwt-authentication-bundle ###
47+
48+
###> symfony/mailer ###
49+
# MAILER_DSN=null://null
50+
###< symfony/mailer ###

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
22
KERNEL_CLASS='App\Kernel'
33
IS_DOCTRINE_ORM_SUPPORTED=true
4+
MAILER_DSN=null://null

.github/workflows/application.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
php: ["8.0", "8.1"]
22-
symfony: ["5.4.*"]
22+
symfony: ["^5.4", "~6.0.0"]
2323
node: ["14.x"]
2424
mysql: ["5.7"]
2525

26+
include:
27+
- php: "8.1"
28+
symfony: "~6.1.0"
29+
node: "14.x"
30+
mysql: "5.7"
31+
2632
steps:
2733
-
2834
uses: actions/checkout@v2
@@ -41,6 +47,7 @@ jobs:
4147
name: Restrict Symfony version
4248
if: matrix.symfony != ''
4349
run: |
50+
composer global config --no-plugins allow-plugins.symfony/flex true
4451
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0"
4552
composer config extra.symfony.require "${{ matrix.symfony }}"
4653
@@ -113,11 +120,18 @@ jobs:
113120
fail-fast: false
114121
matrix:
115122
php: ["8.0", "8.1"]
116-
symfony: ["5.4.*"]
123+
symfony: ["5.4.*", "~6.0.0"]
117124
node: ["14.x"]
118125
mysql: ["5.7"]
119126
behat_driver: ["panther", "chrome", "chrome_headless"]
120127

128+
include:
129+
- php: "8.1"
130+
symfony: "~6.1.0"
131+
node: "14.x"
132+
mysql: "5.7"
133+
behat_driver: "panther"
134+
121135
env:
122136
APP_ENV: test
123137
DATABASE_URL: "mysql://root:[email protected]/monofony?serverVersion=${{ matrix.mysql }}"
@@ -151,6 +165,7 @@ jobs:
151165
name: Restrict Symfony version
152166
if: matrix.symfony != ''
153167
run: |
168+
composer global config --no-plugins allow-plugins.symfony/flex true
154169
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0"
155170
composer config extra.symfony.require "${{ matrix.symfony }}"
156171

.github/workflows/packages.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
php: ["8.0", "8.1"]
60-
symfony: ["5.4.*"]
60+
symfony: ["5.4.*", "~6.0.0"]
6161
package: "${{ fromJson(needs.list.outputs.packages) }}"
6262

63+
include:
64+
- php: "8.1"
65+
symfony: "~6.1.0"
66+
6367
steps:
6468
-
6569
uses: actions/checkout@v2
@@ -90,6 +94,7 @@ jobs:
9094
name: Restrict Symfony version
9195
if: matrix.symfony != ''
9296
run: |
97+
composer global config --no-plugins allow-plugins.symfony/flex true
9398
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0"
9499
composer config extra.symfony.require "${{ matrix.symfony }}"
95100
working-directory: "src/Monofony/${{ matrix.package }}"

UPGRADE.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,161 @@
1+
## UPGRADE FOR `0.9.x`
2+
3+
### FROM `0.8.x` TO `0.9x`
4+
5+
Add these lines on `config/packages/monofony_admin.yaml`
6+
7+
```yaml
8+
imports:
9+
- { resource: '@SyliusUiBundle/Resources/config/app/config.yml' }
10+
```
11+
12+
On `config/packages/security.yaml`
13+
```yaml
14+
security:
15+
firewalls:
16+
admin:
17+
# [...]
18+
anonymous: true
19+
api_login:
20+
# [...]
21+
anonymous: true
22+
guard:
23+
authenticators:
24+
- lexik_jwt_authentication.jwt_token_authenticator
25+
```
26+
27+
```yaml
28+
security:
29+
# Add this line
30+
enable_authenticator_manager: true
31+
32+
# [...]
33+
34+
firewalls:
35+
admin:
36+
# [...]
37+
# Remove that line
38+
# anonymous: true
39+
api_login:
40+
# [...]
41+
entry_point: jwt
42+
jwt: true
43+
refresh_jwt:
44+
check_path: /api/token/refresh
45+
```
46+
47+
And replace `IS_AUTHENTICATED_ANONYMOUSLY` with `PUBLIC_ACCESS`
48+
49+
Update controller on routes' configuration with two dots:
50+
51+
Example:
52+
`_controller: App\Controller\DashboardController:indexAction` replaced by `_controller: App\Controller\DashboardController::indexAction`
53+
54+
On `config/routes/api.yaml`
55+
56+
Replace
57+
```yaml
58+
gesdinet_jwt_refresh_token:
59+
path: /api/token/refresh
60+
controller: gesdinet.jwtrefreshtoken::refresh
61+
```
62+
63+
With
64+
```yaml
65+
api_refresh_token:
66+
path: /api/token/refresh
67+
```
68+
69+
On `config/packages/test/framework.yaml`
70+
71+
Replace
72+
```yaml
73+
framework:
74+
test: ~
75+
session:
76+
storage_id: session.storage.mock_file
77+
```
78+
79+
With
80+
```yaml
81+
framework:
82+
test: ~
83+
session:
84+
storage_factory_id: session.storage.factory.mock_file
85+
```
86+
87+
On `config/packages/test/monofony_core.yaml`
88+
89+
Replace
90+
```yaml
91+
swiftmailer:
92+
spool:
93+
type: file
94+
path: "%kernel.cache_dir%/spool"
95+
```
96+
97+
With
98+
```yaml
99+
framework:
100+
cache:
101+
pools:
102+
test.mailer_pool:
103+
adapter: cache.adapter.filesystem
104+
```
105+
106+
on `src/EventSubscriber/CanonicalaizerSubscriber.php`
107+
108+
Replace
109+
```php
110+
} elseif ($item instanceof UserInterface) {
111+
```
112+
113+
With
114+
```php
115+
} elseif ($item instanceof UserInterface && method_exists($item, 'getUsername')) {
116+
```
117+
118+
on `src/EventSubscriber/DefaultUsernameORMSubscriber.php`
119+
120+
Replace
121+
```php
122+
if ($customer->getEmail() === $user->getUsername() && $customer->getEmailCanonical() === $user->getUsernameCanonical()) {
123+
continue;
124+
}
125+
```
126+
127+
With
128+
```php
129+
if (!method_exists($user, 'getUsername')) {
130+
continue;
131+
}
132+
if ($customer->getEmail() === $user->getUsername() && $customer->getEmailCanonical() === $user->getUsernameCanonical()) {
133+
continue;
134+
}
135+
```
136+
137+
on `src/Security/UserChecker.php`
138+
139+
Replace
140+
```php
141+
if (!$user instanceof User) {
142+
return;
143+
}
144+
```
145+
146+
With
147+
```php
148+
if (!$user instanceof AdvancedUserInterface || !method_exists($user, 'isCredentialsNonExpired')
149+
return;
150+
}
151+
```
152+
153+
And add this line on imports
154+
155+
```php
156+
use SyliusLabs\Polyfill\Symfony\Security\Core\User\AdvancedUserInterface;
157+
```
158+
1159
## UPGRADE FOR `0.4.x`
2160

3161
### FROM `0.2.x` TO `0.4.x`

composer.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,41 @@
7070
"doctrine/annotations": "^1.0",
7171
"doctrine/doctrine-bundle": "^2.2",
7272
"doctrine/doctrine-fixtures-bundle": "^3.4",
73-
"doctrine/doctrine-migrations-bundle": "3.1.*",
73+
"doctrine/doctrine-migrations-bundle": "^3.2",
74+
"doctrine/migrations": "^3.5",
7475
"doctrine/orm": "^2.5",
75-
"doctrine/migrations": "3.2.*",
7676
"fakerphp/faker": "^1.14",
7777
"gesdinet/jwt-refresh-token-bundle": "^1.0",
7878
"lexik/jwt-authentication-bundle": "^2.14",
7979
"liip/imagine-bundle": "^2.2",
80-
"sylius/customer-bundle": "^1.11",
81-
"sylius/ui-bundle": "^1.11",
82-
"sylius/user-bundle": "^1.11",
8380
"nelmio/cors-bundle": "^2.1",
8481
"pagerfanta/pagerfanta": "^3.5",
8582
"phpdocumentor/reflection-docblock": "^5.2",
8683
"sensio/framework-extra-bundle": "^6.2",
87-
"sensiolabs/security-checker": "^6.0",
8884
"sonata-project/block-bundle": "^4.2",
89-
"sylius/grid-bundle": "^1.11",
90-
"sylius/mailer-bundle": "^1.6",
91-
"sylius/resource-bundle": "^1.9",
92-
"symfony/asset": "5.4.*",
93-
"symfony/dotenv": "5.4.*",
94-
"symfony/expression-language": "5.4.*",
85+
"sylius/customer-bundle": "^1.12",
86+
"sylius/grid-bundle": "^1.12",
87+
"sylius/mailer-bundle": "^2.0@beta",
88+
"sylius/resource-bundle": "^1.10",
89+
"sylius/ui-bundle": "^1.12",
90+
"sylius/user": "^1.12 || ^1.12@dev",
91+
"sylius/user-bundle": "^1.12 || ^1.12@dev",
92+
"symfony/asset": "^5.4 || ^6.0",
93+
"symfony/dotenv": "^5.4 || ^6.0",
94+
"symfony/expression-language": "^5.4 || ^6.0",
9595
"symfony/flex": "^2.0",
96-
"symfony/framework-bundle": "5.4.*",
97-
"symfony/messenger": "5.4.*",
96+
"symfony/framework-bundle": "^5.4 || ^6.0",
97+
"symfony/mailer": "^5.4 || ^6.0",
98+
"symfony/messenger": "^5.4 || ^6.0",
9899
"symfony/monolog-bundle": "^3.3",
99100
"symfony/polyfill-php80": "^1.15",
100-
"symfony/property-access": "5.4.*",
101-
"symfony/property-info": "5.4.*",
102-
"symfony/proxy-manager-bridge": "5.4.*",
103-
"symfony/security-bundle": "5.4.*",
104-
"symfony/serializer": "5.4.*",
105-
"symfony/swiftmailer-bundle": "^3.0",
106-
"symfony/twig-bundle": "5.4.*",
107-
"symfony/validator": "5.4.*",
101+
"symfony/property-access": "^5.4 || ^6.0",
102+
"symfony/property-info": "^5.4 || ^6.0",
103+
"symfony/proxy-manager-bridge": "^5.4 || ^6.0",
104+
"symfony/security-bundle": "^5.4 || ^6.0",
105+
"symfony/serializer": "^5.4 || ^6.0",
106+
"symfony/twig-bundle": "^5.4 || ^6.0",
107+
"symfony/validator": "^5.4 || ^6.0",
108108
"symfony/webpack-encore-bundle": "^1.6",
109109
"twig/extensions": "^1.5",
110110
"twig/twig": "^2.7",
@@ -126,7 +126,6 @@
126126
"friends-of-behat/symfony-extension": "^2.0",
127127
"friends-of-behat/variadic-extension": "^1.1",
128128
"friendsofphp/php-cs-fixer": "^3.0",
129-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
130129
"lchrusciel/api-test-case": "^5.1",
131130
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
132131
"phpspec/phpspec": "^7.2",
@@ -138,19 +137,17 @@
138137
"rector/rector": "^0.12",
139138
"robertfausk/behat-panther-extension": "^1.1",
140139
"se/selenium-server-standalone": "2.*",
141-
"symfony/debug-bundle": "5.4.*",
140+
"symfony/debug-bundle": "^5.4 || ^6.0",
142141
"symfony/maker-bundle": "^1.36",
143-
"symfony/web-profiler-bundle": "5.4.*",
142+
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
144143
"symplify/easy-coding-standard": "^9.0",
145-
"symplify/monorepo-builder": "^8.0",
144+
"symplify/monorepo-builder": "^11.0",
146145
"vimeo/psalm": "^4.22"
147146
},
148147
"conflict": {
149-
"sylius/ui-bundle": "^1.11.6",
150148
"symfony/symfony": "*",
151149
"symplify/package-builder": "^7.2",
152150
"symplify/smart-file-system": "^7.2",
153-
"symplify/monorepo-builder": "^7.2",
154151
"symfony/polyfill-mbstring": "1.22.0"
155152
},
156153
"scripts": {
@@ -183,7 +180,10 @@
183180
"extra": {
184181
"symfony": {
185182
"allow-contrib": true,
186-
"require": "5.4.*"
183+
"require": "^6.0"
184+
},
185+
"branch-alias": {
186+
"dev-master": "0.9-dev"
187187
}
188188
}
189189
}

config/bundles.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
66
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
77
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
8-
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
98
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
109
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
1110
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
@@ -31,7 +30,6 @@
3130
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
3231
Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true],
3332
Monofony\Bundle\CoreBundle\MonofonyCoreBundle::class => ['all' => true],
34-
Sonata\Doctrine\Bridge\Symfony\SonataDoctrineSymfonyBundle::class => ['all' => true],
3533
Sonata\Form\Bridge\Symfony\Bundle\SonataFormBundle::class => ['all' => true],
3634
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
3735
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],

config/packages/dev/swiftmailer.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/packages/mailer.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
mailer:
3+
dsn: '%env(MAILER_DSN)%'

0 commit comments

Comments
 (0)