Last active
December 31, 2015 13:08
-
-
Save dominikzogg/7990454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlogController | |
{ | |
/** | |
* @var \Twig_Environment | |
*/ | |
protected $twig; | |
/** | |
* @var Twig_Environment | |
*/ | |
public function __construct(\Twig_Environment $twig) | |
{ | |
$this->twig = $twig; | |
} | |
/** | |
* @param Request $request | |
*/ | |
public function listAction(Request $request) | |
{ | |
return $this->twig->render.... | |
} | |
/** | |
* @param Request $request | |
* @param integer $id | |
*/ | |
public function viewAction(Request $request, $id) | |
{ | |
return $this->twig->render.... | |
} | |
} | |
$app['blog.controller'] = $app->share(function() use ($app) { | |
return new BlogController($app['twig']); | |
}); | |
$blogActions = $app['controllers_factory']; | |
$blogActions->get('/', 'blog.controller:listAction'); | |
$blogActions->get('/{id}', 'blog.controller:viewAction'); | |
$app->mount('/{_locale}/blog', $blogActions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment