1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-15 13:45:04 -05:00

[change] separation of controllers code

This commit is contained in:
Nicolas Lœuillet 2014-01-15 22:22:43 +01:00
parent 841d7f9cbe
commit 0a303e4353
2 changed files with 27 additions and 4 deletions

View File

@ -1,15 +1,18 @@
<?php
use Poche\Model\Entry;
use Poche\Controller;
use Symfony\Component\HttpFoundation\Request;
$front = $app['controllers_factory'];
$front->get('/', function () use ($app) {
// $front->get('/', function () use ($app) {
$entries = $app['entry_api']->getEntries('unread');
// $entries = $app['entry_api']->getEntries('unread');
return $app['twig']->render('index.twig', array('entries' => $entries));
});
// return $app['twig']->render('index.twig', array('entries' => $entries));
// });
$front->get('/', 'Poche\Controller\EntryController::indexAction');
$front->get('/view/{id}', function (Request $request, $id) use ($app) {

View File

@ -0,0 +1,20 @@
<?php
namespace Poche\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
/**
* Entry controller.
*/
class EntryController
{
public function indexAction(Request $request, Application $app)
{
$entries = $app['entry_api']->getEntries('unread');
return $app['twig']->render('index.twig', array('entries' => $entries));
}
}