Skip to content

Instantly share code, notes, and snippets.

@ABM-Dan
Created September 16, 2016 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ABM-Dan/5e1963df13a7c05dd959790ace3876bc to your computer and use it in GitHub Desktop.
Save ABM-Dan/5e1963df13a7c05dd959790ace3876bc to your computer and use it in GitHub Desktop.
<?php
use Silex\Application;
use Demo\Repository\PostRepository;
$app = new Application();
$app['dao.article'] = function() {
// $app['db'] def and $app['dao.user'] defined elsewhere
$articleDAO = new ArticleDAO($app['db']);
$articleDAO->setUserDAO($app['dao.user']);
return $articleDAO;
};
$app['home.controller'] = function() use ($app) {
return new HomeController($app['dao.article']);
};
$app->get('/', "home.controller:indexAction");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment