Skip to content

Commit

Permalink
Compatibility with Symfony 6.x (#34)
Browse files Browse the repository at this point in the history
* Compatibility with Symfony 6.x

* Add missing method getLocale on StubTranslator

* Handle new way to access container in WorkflowControllerTrait

* Switched automated tests to Symfony 6.1
  • Loading branch information
yann-eugone authored May 31, 2022
1 parent ea912e9 commit fb3c63d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ jobs:
symfony-version: 4.4.*
sonata-version: ^4.0
- php-version: 8.0
symfony-version: 5.3.*
symfony-version: 5.4.*
sonata-version: ^4.0
- php-version: 8.1
symfony-version: 6.1.*
sonata-version: ^4.0

steps:
Expand Down Expand Up @@ -48,8 +51,8 @@ jobs:
strategy:
matrix:
include:
- php-version: 8.0
symfony-version: 5.3.*
- php-version: 8.1
symfony-version: 6.1.*

steps:
- name: "Checkout"
Expand All @@ -75,8 +78,8 @@ jobs:
strategy:
matrix:
include:
- php-version: 8.0
symfony-version: 5.3.*
- php-version: 8.1
symfony-version: 6.1.*

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require": {
"php": "^7.4|^8.0",
"sonata-project/admin-bundle": "^4.0",
"symfony/workflow": "^4.4|^5.0"
"symfony/workflow": "^4.4|^5.0|^6.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
4 changes: 3 additions & 1 deletion src/Controller/WorkflowControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ protected function getWorkflow(object $object): Workflow
try {
if (method_exists($this, 'get')) {
$registry = $this->get('workflow.registry');
} else {
} elseif (method_exists($this, 'getContainer')) {
$registry = $this->getContainer()->get('workflow.registry');
} else {
$registry = $this->container->get('workflow.registry');
}
} catch (ServiceNotFoundException $exception) {
throw new \LogicException(
Expand Down
5 changes: 5 additions & 0 deletions tests/Fixtures/StubTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul
{
return '[trans]' . strtr($id, $parameters) . '[/trans]';
}

public function getLocale(): string
{
return 'fa_KE';
}
}

0 comments on commit fb3c63d

Please sign in to comment.