ControllerReference.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 $controller;
  26. public $attributes = array();
  27. public $query = array();
  28. /**
  29. * @param string $controller The controller name
  30. * @param array $attributes An array of parameters to add to the Request attributes
  31. * @param array $query An array of parameters to add to the Request query string
  32. */
  33. public function __construct($controller, array $attributes = array(), array $query = array())
  34. {
  35. $this->controller = $controller;
  36. $this->attributes = $attributes;
  37. $this->query = $query;
  38. }
  39. }