34
34
*
35
35
* @author Fabien Potencier <[email protected] >
36
36
*/
37
- class Controller extends ContainerAware
37
+ abstract class Controller extends ContainerAware
38
38
{
39
39
/**
40
40
* Generates a URL from the given parameters.
@@ -47,7 +47,7 @@ class Controller extends ContainerAware
47
47
*
48
48
* @see UrlGeneratorInterface
49
49
*/
50
- public function generateUrl ($ route , $ parameters = array (), $ referenceType = UrlGeneratorInterface::ABSOLUTE_PATH )
50
+ protected function generateUrl ($ route , $ parameters = array (), $ referenceType = UrlGeneratorInterface::ABSOLUTE_PATH )
51
51
{
52
52
return $ this ->container ->get ('router ' )->generate ($ route , $ parameters , $ referenceType );
53
53
}
@@ -61,7 +61,7 @@ public function generateUrl($route, $parameters = array(), $referenceType = UrlG
61
61
*
62
62
* @return Response A Response instance
63
63
*/
64
- public function forward ($ controller , array $ path = array (), array $ query = array ())
64
+ protected function forward ($ controller , array $ path = array (), array $ query = array ())
65
65
{
66
66
$ path ['_controller ' ] = $ controller ;
67
67
$ subRequest = $ this ->container ->get ('request_stack ' )->getCurrentRequest ()->duplicate ($ query , null , $ path );
@@ -77,7 +77,7 @@ public function forward($controller, array $path = array(), array $query = array
77
77
*
78
78
* @return RedirectResponse
79
79
*/
80
- public function redirect ($ url , $ status = 302 )
80
+ protected function redirect ($ url , $ status = 302 )
81
81
{
82
82
return new RedirectResponse ($ url , $ status );
83
83
}
@@ -156,7 +156,7 @@ protected function denyAccessUnlessGranted($attributes, $object = null, $message
156
156
*
157
157
* @return string The rendered view
158
158
*/
159
- public function renderView ($ view , array $ parameters = array ())
159
+ protected function renderView ($ view , array $ parameters = array ())
160
160
{
161
161
return $ this ->container ->get ('templating ' )->render ($ view , $ parameters );
162
162
}
@@ -170,7 +170,7 @@ public function renderView($view, array $parameters = array())
170
170
*
171
171
* @return Response A Response instance
172
172
*/
173
- public function render ($ view , array $ parameters = array (), Response $ response = null )
173
+ protected function render ($ view , array $ parameters = array (), Response $ response = null )
174
174
{
175
175
return $ this ->container ->get ('templating ' )->renderResponse ($ view , $ parameters , $ response );
176
176
}
@@ -184,7 +184,7 @@ public function render($view, array $parameters = array(), Response $response =
184
184
*
185
185
* @return StreamedResponse A StreamedResponse instance
186
186
*/
187
- public function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
187
+ protected function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
188
188
{
189
189
$ templating = $ this ->container ->get ('templating ' );
190
190
@@ -213,7 +213,7 @@ public function stream($view, array $parameters = array(), StreamedResponse $res
213
213
*
214
214
* @return NotFoundHttpException
215
215
*/
216
- public function createNotFoundException ($ message = 'Not Found ' , \Exception $ previous = null )
216
+ protected function createNotFoundException ($ message = 'Not Found ' , \Exception $ previous = null )
217
217
{
218
218
return new NotFoundHttpException ($ message , $ previous );
219
219
}
@@ -230,7 +230,7 @@ public function createNotFoundException($message = 'Not Found', \Exception $prev
230
230
*
231
231
* @return AccessDeniedException
232
232
*/
233
- public function createAccessDeniedException ($ message = 'Access Denied ' , \Exception $ previous = null )
233
+ protected function createAccessDeniedException ($ message = 'Access Denied ' , \Exception $ previous = null )
234
234
{
235
235
return new AccessDeniedException ($ message , $ previous );
236
236
}
@@ -244,7 +244,7 @@ public function createAccessDeniedException($message = 'Access Denied', \Excepti
244
244
*
245
245
* @return Form
246
246
*/
247
- public function createForm ($ type , $ data = null , array $ options = array ())
247
+ protected function createForm ($ type , $ data = null , array $ options = array ())
248
248
{
249
249
return $ this ->container ->get ('form.factory ' )->create ($ type , $ data , $ options );
250
250
}
@@ -257,7 +257,7 @@ public function createForm($type, $data = null, array $options = array())
257
257
*
258
258
* @return FormBuilder
259
259
*/
260
- public function createFormBuilder ($ data = null , array $ options = array ())
260
+ protected function createFormBuilder ($ data = null , array $ options = array ())
261
261
{
262
262
return $ this ->container ->get ('form.factory ' )->createBuilder ('form ' , $ data , $ options );
263
263
}
@@ -269,7 +269,7 @@ public function createFormBuilder($data = null, array $options = array())
269
269
*
270
270
* @throws \LogicException If DoctrineBundle is not available
271
271
*/
272
- public function getDoctrine ()
272
+ protected function getDoctrine ()
273
273
{
274
274
if (!$ this ->container ->has ('doctrine ' )) {
275
275
throw new \LogicException ('The DoctrineBundle is not registered in your application. ' );
@@ -287,7 +287,7 @@ public function getDoctrine()
287
287
*
288
288
* @see TokenInterface::getUser()
289
289
*/
290
- public function getUser ()
290
+ protected function getUser ()
291
291
{
292
292
if (!$ this ->container ->has ('security.context ' )) {
293
293
throw new \LogicException ('The SecurityBundle is not registered in your application. ' );
@@ -311,7 +311,7 @@ public function getUser()
311
311
*
312
312
* @return bool true if the service id is defined, false otherwise
313
313
*/
314
- public function has ($ id )
314
+ protected function has ($ id )
315
315
{
316
316
return $ this ->container ->has ($ id );
317
317
}
@@ -323,7 +323,7 @@ public function has($id)
323
323
*
324
324
* @return object The service
325
325
*/
326
- public function get ($ id )
326
+ protected function get ($ id )
327
327
{
328
328
return $ this ->container ->get ($ id );
329
329
}
0 commit comments