MapQueryParameter.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Attribute;
  11. use Symfony\Component\HttpKernel\Controller\ArgumentResolver\QueryParameterValueResolver;
  12. /**
  13. * Can be used to pass a query parameter to a controller argument.
  14. *
  15. * @author Ruud Kamphuis <ruud@ticketswap.com>
  16. */
  17. #[\Attribute(\Attribute::TARGET_PARAMETER)]
  18. final class MapQueryParameter extends ValueResolver
  19. {
  20. /**
  21. * @see https://php.net/manual/filter.constants for filter, flags and options
  22. *
  23. * @param string|null $name The name of the query parameter. If null, the name of the argument in the controller will be used.
  24. */
  25. public function __construct(
  26. public ?string $name = null,
  27. public ?int $filter = null,
  28. public int $flags = 0,
  29. public array $options = [],
  30. string $resolver = QueryParameterValueResolver::class,
  31. ) {
  32. parent::__construct($resolver);
  33. }
  34. }