3333 *
3434 * @author Fabien Potencier <[email protected] > 3535 */
36- class Controller extends ContainerAware
36+ abstract class Controller extends ContainerAware
3737{
3838 /**
3939 * Generates a URL from the given parameters.
@@ -46,7 +46,7 @@ class Controller extends ContainerAware
4646 *
4747 * @see UrlGeneratorInterface
4848 */
49- public function generateUrl ($ route , $ parameters = array (), $ referenceType = UrlGeneratorInterface::ABSOLUTE_PATH )
49+ protected function generateUrl ($ route , $ parameters = array (), $ referenceType = UrlGeneratorInterface::ABSOLUTE_PATH )
5050 {
5151 return $ this ->container ->get ('router ' )->generate ($ route , $ parameters , $ referenceType );
5252 }
@@ -60,7 +60,7 @@ public function generateUrl($route, $parameters = array(), $referenceType = UrlG
6060 *
6161 * @return Response A Response instance
6262 */
63- public function forward ($ controller , array $ path = array (), array $ query = array ())
63+ protected function forward ($ controller , array $ path = array (), array $ query = array ())
6464 {
6565 $ path ['_controller ' ] = $ controller ;
6666 $ subRequest = $ this ->container ->get ('request_stack ' )->getCurrentRequest ()->duplicate ($ query , null , $ path );
@@ -76,7 +76,7 @@ public function forward($controller, array $path = array(), array $query = array
7676 *
7777 * @return RedirectResponse
7878 */
79- public function redirect ($ url , $ status = 302 )
79+ protected function redirect ($ url , $ status = 302 )
8080 {
8181 return new RedirectResponse ($ url , $ status );
8282 }
@@ -155,7 +155,7 @@ protected function denyAccessUnlessGranted($attributes, $object = null, $message
155155 *
156156 * @return string The rendered view
157157 */
158- public function renderView ($ view , array $ parameters = array ())
158+ protected function renderView ($ view , array $ parameters = array ())
159159 {
160160 return $ this ->container ->get ('templating ' )->render ($ view , $ parameters );
161161 }
@@ -169,7 +169,7 @@ public function renderView($view, array $parameters = array())
169169 *
170170 * @return Response A Response instance
171171 */
172- public function render ($ view , array $ parameters = array (), Response $ response = null )
172+ protected function render ($ view , array $ parameters = array (), Response $ response = null )
173173 {
174174 return $ this ->container ->get ('templating ' )->renderResponse ($ view , $ parameters , $ response );
175175 }
@@ -183,7 +183,7 @@ public function render($view, array $parameters = array(), Response $response =
183183 *
184184 * @return StreamedResponse A StreamedResponse instance
185185 */
186- public function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
186+ protected function stream ($ view , array $ parameters = array (), StreamedResponse $ response = null )
187187 {
188188 $ templating = $ this ->container ->get ('templating ' );
189189
@@ -212,7 +212,7 @@ public function stream($view, array $parameters = array(), StreamedResponse $res
212212 *
213213 * @return NotFoundHttpException
214214 */
215- public function createNotFoundException ($ message = 'Not Found ' , \Exception $ previous = null )
215+ protected function createNotFoundException ($ message = 'Not Found ' , \Exception $ previous = null )
216216 {
217217 return new NotFoundHttpException ($ message , $ previous );
218218 }
@@ -229,7 +229,7 @@ public function createNotFoundException($message = 'Not Found', \Exception $prev
229229 *
230230 * @return AccessDeniedException
231231 */
232- public function createAccessDeniedException ($ message = 'Access Denied ' , \Exception $ previous = null )
232+ protected function createAccessDeniedException ($ message = 'Access Denied ' , \Exception $ previous = null )
233233 {
234234 return new AccessDeniedException ($ message , $ previous );
235235 }
@@ -243,7 +243,7 @@ public function createAccessDeniedException($message = 'Access Denied', \Excepti
243243 *
244244 * @return Form
245245 */
246- public function createForm ($ type , $ data = null , array $ options = array ())
246+ protected function createForm ($ type , $ data = null , array $ options = array ())
247247 {
248248 return $ this ->container ->get ('form.factory ' )->create ($ type , $ data , $ options );
249249 }
@@ -256,7 +256,7 @@ public function createForm($type, $data = null, array $options = array())
256256 *
257257 * @return FormBuilder
258258 */
259- public function createFormBuilder ($ data = null , array $ options = array ())
259+ protected function createFormBuilder ($ data = null , array $ options = array ())
260260 {
261261 return $ this ->container ->get ('form.factory ' )->createBuilder ('form ' , $ data , $ options );
262262 }
@@ -270,7 +270,7 @@ public function createFormBuilder($data = null, array $options = array())
270270 * Symfony to inject the Request object into your controller
271271 * method instead by type hinting it in the method's signature.
272272 */
273- public function getRequest ()
273+ protected function getRequest ()
274274 {
275275 return $ this ->container ->get ('request_stack ' )->getCurrentRequest ();
276276 }
@@ -282,7 +282,7 @@ public function getRequest()
282282 *
283283 * @throws \LogicException If DoctrineBundle is not available
284284 */
285- public function getDoctrine ()
285+ protected function getDoctrine ()
286286 {
287287 if (!$ this ->container ->has ('doctrine ' )) {
288288 throw new \LogicException ('The DoctrineBundle is not registered in your application. ' );
@@ -300,7 +300,7 @@ public function getDoctrine()
300300 *
301301 * @see Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getUser()
302302 */
303- public function getUser ()
303+ protected function getUser ()
304304 {
305305 if (!$ this ->container ->has ('security.context ' )) {
306306 throw new \LogicException ('The SecurityBundle is not registered in your application. ' );
@@ -324,7 +324,7 @@ public function getUser()
324324 *
325325 * @return bool true if the service id is defined, false otherwise
326326 */
327- public function has ($ id )
327+ protected function has ($ id )
328328 {
329329 return $ this ->container ->has ($ id );
330330 }
@@ -336,7 +336,7 @@ public function has($id)
336336 *
337337 * @return object The service
338338 */
339- public function get ($ id )
339+ protected function get ($ id )
340340 {
341341 return $ this ->container ->get ($ id );
342342 }
0 commit comments