forked from propelorm/PropelBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropelBundle.php
75 lines (65 loc) · 2.45 KB
/
PropelBundle.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* This file is part of the PropelBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Propel\Bundle\PropelBundle;
use Propel\Bundle\PropelBundle\DependencyInjection\Security\UserProvider\PropelFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* PropelBundle.
*
* @author William DURAND <[email protected]>
*/
class PropelBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function boot()
{
require_once $this->container->getParameter('propel.path').'/runtime/lib/Propel.php';
if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
set_include_path($this->container->getParameter('kernel.root_dir').'/..'.PATH_SEPARATOR.
$this->container->getParameter('propel.phing_path').PATH_SEPARATOR.
$this->container->getParameter('propel.phing_path').'/classes'.PATH_SEPARATOR.
get_include_path());
}
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
if ($this->container->getParameter('propel.logging')) {
$config = $this
->container
->get('propel.configuration')
;
$config->setParameter('debugpdo.logging.methods', array(
'PropelPDO::exec',
'PropelPDO::query',
'PropelPDO::prepare',
'DebugPDOStatement::execute',
), false);
$config->setParameter('debugpdo.logging.details', array(
'time' => array('enabled' => true),
'mem' => array('enabled' => true),
'connection' => array('enabled' => true),
));
\Propel::setLogger($this->container->get('propel.logger'));
}
\Propel::initialize();
}
}
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
if ($container->hasExtension('security')) {
$container->getExtension('security')->addUserProviderFactory(new PropelFactory('propel', 'propel.security.user.provider'));
}
}
}