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