Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 77 lines (65 sloc) 2.498 kB
d2b2a18 @fabpot added files
fabpot authored
1 <?php
2
87ad04f @willdurand Fixed LICENSE
willdurand authored
3 /**
4 * This file is part of the PropelBundle package.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
7 *
8 * @license MIT License
9 */
10
5b5feec @willdurand Changed namespace to Propel\PropelBundle
willdurand authored
11 namespace Propel\PropelBundle;
d2b2a18 @fabpot added files
fabpot authored
12
c23c768 @willdurand Fixed security layer for Symfony2 2.1
willdurand authored
13 use Symfony\Bridge\Propel1\DependencyInjection\Security\UserProvider\PropelFactory;
d2b2a18 @fabpot added files
fabpot authored
14 use Symfony\Component\HttpKernel\Bundle\Bundle;
e9e476a @willdurand Refactored bundle class
willdurand authored
15 use Symfony\Component\DependencyInjection\ContainerBuilder;
d2b2a18 @fabpot added files
fabpot authored
16
b6871ed @willdurand Fixed licence + doc
willdurand authored
17 /**
18 * PropelBundle
19 *
20 * @author William DURAND <william.durand1@gmail.com>
21 */
d2b2a18 @fabpot added files
fabpot authored
22 class PropelBundle extends Bundle
23 {
b6871ed @willdurand Fixed licence + doc
willdurand authored
24 /**
25 * {@inheritdoc}
26 */
d2b2a18 @fabpot added files
fabpot authored
27 public function boot()
28 {
29 require_once $this->container->getParameter('propel.path').'/runtime/lib/Propel.php';
30
31 if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
b7b5592 @jaugustin Add phing_path directly to includ path to make it work with composer …
jaugustin authored
32 set_include_path($this->container->getParameter('kernel.root_dir').'/..'.PATH_SEPARATOR.
33 $this->container->getParameter('propel.phing_path').PATH_SEPARATOR.
34 $this->container->getParameter('propel.phing_path').'/classes'.PATH_SEPARATOR.
35 get_include_path());
d2b2a18 @fabpot added files
fabpot authored
36 }
9cf426e @willdurand It's necessary to call the Propel service in the boot() method
willdurand authored
37
18d5591 @willdurand Check if Propel is initialized or not
willdurand authored
38 if (!\Propel::isInit()) {
39 \Propel::setConfiguration($this->container->get('propel.configuration'));
da35ed5 @willdurand Load logging if asked
willdurand authored
40
18d5591 @willdurand Check if Propel is initialized or not
willdurand authored
41 if ($this->container->getParameter('propel.logging')) {
2be58a2 @willdurand Added more methods to log in order to use the Stopwatch feature
willdurand authored
42 $config = $this
fe58d40 @willdurand Added more information to the Propel panel by using the Propel logger
willdurand authored
43 ->container
44 ->get('propel.configuration')
2be58a2 @willdurand Added more methods to log in order to use the Stopwatch feature
willdurand authored
45 ;
46 $config->setParameter('debugpdo.logging.methods', array(
47 'PropelPDO::exec',
48 'PropelPDO::query',
49 'PropelPDO::prepare',
50 'DebugPDOStatement::execute',
51 ), false);
52 $config->setParameter('debugpdo.logging.details', array(
53 'time' => array('enabled' => true),
54 'mem' => array('enabled' => true),
7188e19 @cedriclombardot Allow to show explain plans on each queries
cedriclombardot authored
55 'connection' => array('enabled' => true),
2be58a2 @willdurand Added more methods to log in order to use the Stopwatch feature
willdurand authored
56 ));
fe58d40 @willdurand Added more information to the Propel panel by using the Propel logger
willdurand authored
57
18d5591 @willdurand Check if Propel is initialized or not
willdurand authored
58 \Propel::setLogger($this->container->get('propel.logger'));
59 }
da35ed5 @willdurand Load logging if asked
willdurand authored
60
18d5591 @willdurand Check if Propel is initialized or not
willdurand authored
61 \Propel::initialize();
5d6a185 @willdurand Fixed collateral damage due to last reverts
willdurand authored
62 }
e9e476a @willdurand Refactored bundle class
willdurand authored
63 }
c23c768 @willdurand Fixed security layer for Symfony2 2.1
willdurand authored
64
65 /**
66 * {@inheritdoc}
67 */
68 public function build(ContainerBuilder $container)
69 {
70 parent::build($container);
71
72 if ($container->hasExtension('security')) {
73 $container->getExtension('security')->addUserProviderFactory(new PropelFactory('propel', 'propel.security.user.provider'));
74 }
75 }
d2b2a18 @fabpot added files
fabpot authored
76 }
Something went wrong with that request. Please try again.