ControllerReference.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\Controller;
  11. use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
  12. /**
  13. * Acts as a marker and a data holder for a Controller.
  14. *
  15. * Some methods in Symfony accept both a URI (as a string) or a controller as
  16. * an argument. In the latter case, instead of passing an array representing
  17. * the controller, you can use an instance of this class.
  18. *
  19. * @author Fabien Potencier <fabien@symfony.com>
  20. *
  21. * @see FragmentRendererInterface
  22. */
  23. class ControllerReference
  24. {
  25. public array $attributes = [];
  26. public array $query = [];
  27. /**
  28. * @param string $controller The controller name
  29. * @param array $attributes An array of parameters to add to the Request attributes
  30. * @param array $query An array of parameters to add to the Request query string
  31. */
  32. public function __construct(
  33. public string $controller,
  34. array $attributes = [],
  35. array $query = [],
  36. ) {
  37. $this->attributes = $attributes;
  38. $this->query = $query;
  39. }
  40. }