for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Silverback\ApiComponentBundle\Validator\Constraints;
use Silverback\ApiComponentBundle\Repository\RouteRepository;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\UrlValidator;
/**
* @author Daniel West <[email protected]>
* @Annotation()
*/
class LinkValidator extends UrlValidator
{
/** @var RouteRepository */
private $routeRepository;
public function __construct (
RouteRepository $routeRepository
)
$this->routeRepository = $routeRepository;
}
public function validate($value, Constraint $constraint)
$route = $this->routeRepository->find($value);
if ($route) {
return;
parent::validate($value, $constraint);