Skip to content

Commit

Permalink
Allow Symfony 6 (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr authored Jul 14, 2022
1 parent 77f100c commit f85afa1
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ jobs:
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.1'
lint: false
coverage: false
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

services:
mysql:
image: mysql:5.7
Expand Down
2 changes: 1 addition & 1 deletion Controller/HeadlessWebsiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function indexAction(
protected function resolveStructure(StructureInterface $structure): array
{
/** @var StructureResolverInterface $structureResolver */
$structureResolver = $this->get('sulu_headless.structure_resolver');
$structureResolver = $this->container->get('sulu_headless.structure_resolver');

return $structureResolver->resolve($structure, $structure->getLanguageCode());
}
Expand Down
6 changes: 3 additions & 3 deletions Resources/config/routing_website.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
sulu_headless.api.navigation:
path: /api/navigations/{context}.{_format}
defaults:
_controller: sulu_headless.controller.navigation:getAction
_controller: sulu_headless.controller.navigation::getAction
_format: json

sulu_headless.api.search:
path: /api/search
defaults:
_controller: sulu_headless.controller.search:getAction
_controller: sulu_headless.controller.search::getAction

sulu_headless.api.snippet_area:
path: /api/snippet-areas/{area}.{_format}
defaults:
_controller: sulu_headless.controller.snippet_area:getAction
_controller: sulu_headless.controller.snippet_area::getAction
_format: json
2 changes: 1 addition & 1 deletion Tests/Functional/Controller/SnippetAreaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function setUpBeforeClass(): void
'template' => 'default',
], 'de');

$defaultSnippetManager = self::$container->get('sulu_snippet.default_snippet.manager');
$defaultSnippetManager = static::getContainer()->get('sulu_snippet.default_snippet.manager');
$defaultSnippetManager->save(
'sulu_io',
'default',
Expand Down
6 changes: 3 additions & 3 deletions Tests/Traits/CreateMediaTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ trait CreateMediaTrait
{
private static function createCollection(string $title, string $locale): CollectionInterface
{
$manager = static::$container->get('doctrine.orm.entity_manager');
$manager = static::getContainer()->get('doctrine.orm.entity_manager');

$collection = new Collection();

Expand Down Expand Up @@ -59,13 +59,13 @@ private static function createMedia(
CollectionInterface $collection,
string $locale
): MediaInterface {
$manager = static::$container->get('doctrine.orm.entity_manager');
$manager = static::getContainer()->get('doctrine.orm.entity_manager');

$file = new \SplFileInfo(__DIR__ . \DIRECTORY_SEPARATOR . 'test-image.png');
$fileName = $file->getFilename();
$uploadedFile = new UploadedFile($file->getPathname(), $fileName);

$storageOptions = static::$container->get('sulu_media.storage')->save(
$storageOptions = static::getContainer()->get('sulu_media.storage')->save(
$uploadedFile->getPathname(),
$fileName
);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Traits/CreatePageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static function createPage(
string $parentPath = '/cmf/sulu_io/contents'
): PageDocument {
/** @var DocumentManagerInterface $documentManager */
$documentManager = static::$container->get('sulu_document_manager.document_manager');
$documentManager = static::getContainer()->get('sulu_document_manager.document_manager');

/** @var PageDocument $document */
$document = $documentManager->create('page');
Expand Down
2 changes: 1 addition & 1 deletion Tests/Traits/CreateSnippetTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private static function createSnippet(
string $locale = 'de'
): SnippetDocument {
/** @var DocumentManagerInterface $documentManager */
$documentManager = static::$container->get('sulu_document_manager.document_manager');
$documentManager = static::getContainer()->get('sulu_document_manager.document_manager');

/** @var SnippetDocument $document */
$document = $documentManager->create('snippet');
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"description": "Bundle that provides controllers and services for using Sulu as headless content management system",
"require": {
"php": "^7.3 || ^8.0",
"sulu/sulu": "^2.4",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/http-foundation": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0"
"sulu/sulu": "^2.4 || ^2.5@dev",
"symfony/config": "^4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0"
},
"require-dev": {
"coduo/php-matcher": "^5.0 || ^6.0",
Expand All @@ -25,10 +25,10 @@
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpunit/phpunit": "^8.4",
"symfony/browser-kit": "^4.4 || ^5.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/dotenv": "^4.4 || ^5.0",
"symfony/error-handler": "^4.4 || ^5.0",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0",
"symfony/error-handler": "^4.4 || ^5.0 || ^6.0",
"symfony/monolog-bundle": "^3.1",
"thecodingmachine/phpstan-strict-rules": "^0.12"
},
Expand Down

0 comments on commit f85afa1

Please sign in to comment.