1 | <?php |
||
29 | class ResourceBinding extends AbstractBinding |
||
30 | { |
||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $query; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $language; |
||
40 | |||
41 | /** |
||
42 | * @var ResourceRepository |
||
43 | */ |
||
44 | private $repo; |
||
45 | |||
46 | /** |
||
47 | * Creates a new resource binding. |
||
48 | * |
||
49 | * A resource binding has a query that is used to retrieve the resources |
||
50 | * matched by the binding. |
||
51 | * |
||
52 | * You can pass parameters that have been defined for the type. If you pass |
||
53 | * unknown parameters, or if a required parameter is missing, an exception |
||
54 | * is thrown. |
||
55 | * |
||
56 | * All parameters that you do not set here will receive the default values |
||
57 | * set for the parameter. |
||
58 | * |
||
59 | * @param string $query The resource query. |
||
60 | * @param string $typeName The type to bind against. |
||
61 | * @param array $parameterValues The values of the parameters defined |
||
62 | * for the type. |
||
63 | * @param string $language The language of the resource query. |
||
64 | * |
||
65 | * @throws NoSuchParameterException If an invalid parameter was passed. |
||
66 | * @throws MissingParameterException If a required parameter was not passed. |
||
67 | */ |
||
68 | 19 | public function __construct($query, $typeName, array $parameterValues = array(), $language = 'glob') |
|
75 | |||
76 | /** |
||
77 | * Returns the query for the resources of the binding. |
||
78 | * |
||
79 | * @return string The resource query. |
||
80 | */ |
||
81 | 1 | public function getQuery() |
|
85 | |||
86 | /** |
||
87 | * Returns the language of the query. |
||
88 | * |
||
89 | * @return string The query language. |
||
90 | */ |
||
91 | 1 | public function getLanguage() |
|
95 | |||
96 | /** |
||
97 | * Returns the bound resources. |
||
98 | * |
||
99 | * @return ResourceCollection The bound resources. |
||
100 | */ |
||
101 | 2 | public function getResources() |
|
109 | |||
110 | /** |
||
111 | * Sets the repository used to load resources. |
||
112 | * |
||
113 | * @param ResourceRepository $repo The resource repository. |
||
114 | */ |
||
115 | 1 | public function setRepository(ResourceRepository $repo) |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function equals(Binding $other) |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | 2 | protected function preSerialize(array &$data) |
|
147 | |||
148 | /** |
||
149 | * {@inheritdoc} |
||
150 | */ |
||
151 | 2 | protected function postUnserialize(array &$data) |
|
158 | } |
||
159 |