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

Dev ars creo sylius 2 0 #260

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"twig/twig": "<2.9"
},
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0 || ~1.13.0"
"php": "^7.4 || ^8.0 || ^8.3",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0 || ~1.13.0 || ~2.0.0"
},
"require-dev": {
"api-platform/core": "~2.5.0 || ~2.6.0 || ~2.7.0",
Expand Down
25 changes: 17 additions & 8 deletions src/Routing/SitemapLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
use SitemapPlugin\Builder\SitemapBuilderInterface;
use SitemapPlugin\Exception\RouteExistsException;
use Symfony\Bundle\FrameworkBundle\Routing\RouteLoaderInterface;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

final class SitemapLoader extends Loader implements RouteLoaderInterface
final class SitemapLoader implements LoaderInterface, RouteLoaderInterface
{
private bool $loaded = false;
private ?LoaderResolverInterface $resolver = null;

private SitemapBuilderInterface $sitemapBuilder;

public function __construct(
SitemapBuilderInterface $sitemapBuilder,
?string $env = null
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't this more Symfony changes than Sylius specific changes?

SitemapBuilderInterface $sitemapBuilder
) {
$this->sitemapBuilder = $sitemapBuilder;

parent::__construct($env);
}

public function load($resource, $type = null)
public function load(mixed $resource, ?string $type = null): mixed
{
$routes = new RouteCollection();

Expand Down Expand Up @@ -63,8 +62,18 @@ public function load($resource, $type = null)
return $routes;
}

public function supports($resource, $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return 'sitemap' === $type;
}

public function getResolver(): LoaderResolverInterface
{
return $this->resolver ?? throw new \RuntimeException('No resolver has been set');
}

public function setResolver(LoaderResolverInterface $resolver): void
{
$this->resolver = $resolver;
}
}
Loading