MapQueryString.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\HttpFoundation\Response;
  12. use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestPayloadValueResolver;
  13. use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
  14. use Symfony\Component\Validator\Constraints\GroupSequence;
  15. /**
  16. * Controller parameter tag to map the query string of the request to typed object and validate it.
  17. *
  18. * @author Konstantin Myakshin <molodchick@gmail.com>
  19. */
  20. #[\Attribute(\Attribute::TARGET_PARAMETER)]
  21. class MapQueryString extends ValueResolver
  22. {
  23. public ArgumentMetadata $metadata;
  24. public function __construct(
  25. public readonly array $serializationContext = [],
  26. public readonly string|GroupSequence|array|null $validationGroups = null,
  27. string $resolver = RequestPayloadValueResolver::class,
  28. public readonly int $validationFailedStatusCode = Response::HTTP_NOT_FOUND,
  29. ) {
  30. parent::__construct($resolver);
  31. }
  32. }