-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
54 lines (40 loc) · 1.54 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
use Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration;
require_once __DIR__ . '/vendor/autoload.php';
date_default_timezone_set('UTC');
$container = new Pimple();
$container['config'] = $container->share(function($c)
{
//TODO: set application enviroment someplace
$config = new Zend_Config_Ini(__DIR__ . '/config.ini', 'production');
return $config;
});
$container['em'] = $container->share(function($c){
//don't do this
$cache = new \Doctrine\Common\Cache\ArrayCache;
$config = new Configuration;
$config->setMetadataCacheImpl($cache);
$driverImpl = $config->newDefaultAnnotationDriver(realpath(__DIR__ . '/src/TweetBid/Model'));
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCacheImpl($cache);
$config->setProxyDir('/tmp'); //don't do this either
$config->setProxyNamespace('TweetBid\Proxies');
//yeah, not exactily optimized
$config->setAutoGenerateProxyClasses(true);
$connectionOptions = $c['config']->db->toArray();
$em = EntityManager::create($connectionOptions, $config);
return $em;
});
$container["tweeter"] = new TweetBid\Service\Tweeter($container);
$container["gavel"] = new TweetBid\Service\Gavel($container);
// Is this used?
$container['session'] = $container->share(function ($c){
$session = new Zend_Session_Namespace('tweetbid');
return $session;
});
//setup balanced
Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();
Balanced\Settings::$api_key = $container['config']->balanced->key;