fix: Add a deprecation and the new service that goes with it as replacement.

This commit is contained in:
Pol Dellaiera
2021-11-18 14:15:51 +01:00
parent 370a24d3f5
commit 674bf614dd
3 changed files with 68 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Center;
final class CenterResolverManager implements CenterResolverManagerInterface
{
/**
* @var CenterResolverInterface[]
*/
private iterable $resolvers;
public function __construct(iterable $resolvers = [])
{
$this->resolvers = $resolvers;
}
public function resolveCenters($entity, ?array $options = []): array
{
foreach($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {
return (array) $resolver->resolveCenter($entity, $options);
}
}
return [];
}
}