| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
7 |
*
|
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
|
|
9 |
* file that was distributed with this source code.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\HttpKernel\Controller;
|
|
|
13 |
|
|
|
14 |
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Acts as a marker and a data holder for a Controller.
|
|
|
18 |
*
|
|
|
19 |
* Some methods in Symfony accept both a URI (as a string) or a controller as
|
|
|
20 |
* an argument. In the latter case, instead of passing an array representing
|
|
|
21 |
* the controller, you can use an instance of this class.
|
|
|
22 |
*
|
|
|
23 |
* @author Fabien Potencier <fabien@symfony.com>
|
|
|
24 |
*
|
|
|
25 |
* @see FragmentRendererInterface
|
|
|
26 |
*/
|
|
|
27 |
class ControllerReference
|
|
|
28 |
{
|
|
|
29 |
public $controller;
|
|
|
30 |
public $attributes = [];
|
|
|
31 |
public $query = [];
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* @param string $controller The controller name
|
|
|
35 |
* @param array $attributes An array of parameters to add to the Request attributes
|
|
|
36 |
* @param array $query An array of parameters to add to the Request query string
|
|
|
37 |
*/
|
|
|
38 |
public function __construct(string $controller, array $attributes = [], array $query = [])
|
|
|
39 |
{
|
|
|
40 |
$this->controller = $controller;
|
|
|
41 |
$this->attributes = $attributes;
|
|
|
42 |
$this->query = $query;
|
|
|
43 |
}
|
|
|
44 |
}
|