ControllerReference.php 1.3 KB

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