for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Silverback API Components Bundle Project
*
* (c) Daniel West <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Silverback\ApiComponentsBundle\DataProvider\Item;
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
use Silverback\ApiComponentsBundle\Entity\Core\Route;
use Silverback\ApiComponentsBundle\Repository\Core\RouteRepository;
/**
* @author Daniel West <[email protected]>
class RouteDataProvider implements ItemDataProviderInterface, RestrictedDataProviderInterface
{
private RouteRepository $routeRepository;
public function __construct(RouteRepository $routeRepository)
$this->routeRepository = $routeRepository;
}
public function getItem(string $resourceClass, $id, string $operationName = null, array $context = [])
return $this->routeRepository->findOneByIdOrRoute($id);
public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
return Route::class === $resourceClass;