Created
December 27, 2011 04:08
-
-
Save simensen/1522684 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 | |
define('USER_ID', 1); | |
// This sets up everything to include all of your | |
// dependencies. Anything in composer.json will | |
// be available by simply requesting the class name. | |
require 'vendor/.composer/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
//use Symfony\Component\ClassLoader\UniversalClassLoader; | |
use Collexi\ActivityService; | |
$app = new Silex\Application(); | |
/** | |
* Doctrine DBAL | |
*/ | |
$app->register(new Silex\Provider\DoctrineServiceProvider(), array( | |
'db' => array( | |
'dbname' => 'collexi', | |
'user' => 'root', | |
'password' => '', | |
'host' => 'localhost', | |
'driver' => 'pdo_mysql'), | |
)); | |
/** | |
* Twig | |
*/ | |
$app->register(new Silex\Provider\TwigServiceProvider(), array( | |
'twig.path' => __DIR__.'/views', | |
'twig.options' => array('cache' => false), | |
)); | |
/** | |
* Collexi Services | |
*/ | |
$loader = new UniversalClassLoader(); | |
$loader->registerNamespaces( | |
array('Collexi' => __DIR__ . '/src/Collexi')); | |
$app['activity_service'] = function() { | |
// This will not work: | |
//return new ActivityService(); | |
// This will work: | |
return new Collexi\ActivityService(); | |
// | |
// or this would work: | |
// | |
// use Collexi\ActivityService; | |
// return new ActivityService(); | |
// | |
// or this could work: | |
// | |
// use Collexi\ActivityService as ASAlias; | |
// return new ASAlias(); | |
// | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment