-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test deps, fixes CI for 6.x (#399)
* Update test deps, fixes CI for 6.x * PHP-CS-Fixer (3.48.0) + route loader fixes * Fixed compatibility with sf5/6/7
- Loading branch information
1 parent
6c59b79
commit ad99d01
Showing
12 changed files
with
178 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DH\AuditorBundle\Routing; | ||
|
||
use DH\AuditorBundle\Controller\ViewerController; | ||
use RuntimeException; | ||
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader; | ||
use Symfony\Bundle\FrameworkBundle\Routing\AttributeRouteControllerLoader; | ||
use Symfony\Component\Config\Loader\Loader; | ||
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | ||
use Symfony\Component\Routing\RouteCollection; | ||
|
||
if (BaseKernel::MAJOR_VERSION >= 6) { | ||
class RoutingLoader extends Loader | ||
{ | ||
private AttributeRouteControllerLoader $annotatedRouteControllerLoader; | ||
|
||
private bool $isLoaded = false; | ||
|
||
private array $configuration; | ||
|
||
public function __construct(AttributeRouteControllerLoader $annotatedRouteController, array $configuration) | ||
{ | ||
$this->annotatedRouteControllerLoader = $annotatedRouteController; | ||
$this->configuration = $configuration; | ||
} | ||
|
||
public function load(mixed $resource, ?string $type = null): RouteCollection | ||
{ | ||
if ($this->isLoaded) { | ||
throw new RuntimeException('Do not add the "audit" loader twice'); | ||
} | ||
|
||
$routeCollection = new RouteCollection(); | ||
if (true === $this->configuration['viewer']) { | ||
$routeCollection = $this->annotatedRouteControllerLoader->load(ViewerController::class); | ||
} | ||
|
||
$this->isLoaded = true; | ||
|
||
return $routeCollection; | ||
} | ||
|
||
/** | ||
* @param ?string $type | ||
*/ | ||
public function supports(mixed $resource, ?string $type = null): bool | ||
{ | ||
return 'auditor' === $type; | ||
} | ||
} | ||
} else { | ||
class RoutingLoader extends Loader | ||
{ | ||
private AnnotatedRouteControllerLoader $annotatedRouteControllerLoader; | ||
|
||
private bool $isLoaded = false; | ||
|
||
private array $configuration; | ||
|
||
public function __construct(AnnotatedRouteControllerLoader $annotatedRouteController, array $configuration) | ||
{ | ||
$this->annotatedRouteControllerLoader = $annotatedRouteController; | ||
$this->configuration = $configuration; | ||
} | ||
|
||
public function load(mixed $resource, ?string $type = null): RouteCollection | ||
{ | ||
if ($this->isLoaded) { | ||
throw new RuntimeException('Do not add the "audit" loader twice'); | ||
} | ||
|
||
$routeCollection = new RouteCollection(); | ||
if (true === $this->configuration['viewer']) { | ||
$routeCollection = $this->annotatedRouteControllerLoader->load(ViewerController::class); | ||
} | ||
|
||
$this->isLoaded = true; | ||
|
||
return $routeCollection; | ||
} | ||
|
||
/** | ||
* @param ?string $type | ||
*/ | ||
public function supports(mixed $resource, ?string $type = null): bool | ||
{ | ||
return 'auditor' === $type; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
use DH\AuditorBundle\DHAuditorBundle; | ||
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Bundle\SecurityBundle\SecurityBundle; | ||
use Symfony\Bundle\TwigBundle\TwigBundle; | ||
use Twig\Extra\TwigExtraBundle\TwigExtraBundle; | ||
|
||
return [ | ||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | ||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], | ||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | ||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], | ||
DH\AuditorBundle\DHAuditorBundle::class => ['all' => true], | ||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], | ||
FrameworkBundle::class => ['all' => true], | ||
DoctrineBundle::class => ['all' => true], | ||
TwigBundle::class => ['all' => true], | ||
SecurityBundle::class => ['all' => true], | ||
DHAuditorBundle::class => ['all' => true], | ||
TwigExtraBundle::class => ['all' => true], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
DH\AuditorBundle\Tests\App\Command\CreatePostCommand: | ||
|
||
DH\AuditorBundle\Routing\RoutingLoader: | ||
arguments: | ||
- '@routing.loader.annotation' | ||
- '%dh_auditor.provider.doctrine.configuration%' | ||
tags: | ||
- { name: routing.loader } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.