2010-10-28 14:41:03 +02:00
|
|
|
|
<?php
|
|
|
|
|
|
2011-08-30 23:29:49 +02:00
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2016-01-23 21:41:17 +01:00
|
|
|
|
namespace Propel\Bundle\PropelBundle;
|
2010-10-28 14:41:03 +02:00
|
|
|
|
|
2016-01-23 21:41:17 +01:00
|
|
|
|
use Propel\Bundle\PropelBundle\DependencyInjection\Security\UserProvider\PropelFactory;
|
2011-01-22 16:15:43 +01:00
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
2016-01-23 16:52:33 +01:00
|
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
2010-10-28 14:41:03 +02:00
|
|
|
|
|
2011-04-07 10:01:30 +02:00
|
|
|
|
/**
|
2016-01-23 16:52:33 +01:00
|
|
|
|
* PropelBundle.
|
2011-04-07 10:01:30 +02:00
|
|
|
|
*
|
|
|
|
|
* @author William DURAND <william.durand1@gmail.com>
|
|
|
|
|
*/
|
2010-10-28 14:41:03 +02:00
|
|
|
|
class PropelBundle extends Bundle
|
|
|
|
|
{
|
2011-04-07 10:01:30 +02:00
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
2010-10-28 14:41:03 +02:00
|
|
|
|
public function boot()
|
|
|
|
|
{
|
|
|
|
|
require_once $this->container->getParameter('propel.path').'/runtime/lib/Propel.php';
|
|
|
|
|
|
|
|
|
|
if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
|
2012-03-07 15:47:57 +01:00
|
|
|
|
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());
|
2010-10-28 14:41:03 +02:00
|
|
|
|
}
|
2011-01-25 21:23:03 +01:00
|
|
|
|
|
2011-04-06 18:19:13 +02:00
|
|
|
|
if (!\Propel::isInit()) {
|
|
|
|
|
\Propel::setConfiguration($this->container->get('propel.configuration'));
|
2011-04-05 21:21:05 +02:00
|
|
|
|
|
2011-04-06 18:19:13 +02:00
|
|
|
|
if ($this->container->getParameter('propel.logging')) {
|
2012-02-14 12:10:12 +01:00
|
|
|
|
$config = $this
|
2011-04-08 01:16:09 +02:00
|
|
|
|
->container
|
|
|
|
|
->get('propel.configuration')
|
2012-02-14 12:10:12 +01:00
|
|
|
|
;
|
|
|
|
|
$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),
|
2016-01-23 16:52:33 +01:00
|
|
|
|
'mem' => array('enabled' => true),
|
2012-03-16 12:32:50 +01:00
|
|
|
|
'connection' => array('enabled' => true),
|
2012-02-14 12:10:12 +01:00
|
|
|
|
));
|
2011-04-08 01:16:09 +02:00
|
|
|
|
|
2011-04-06 18:19:13 +02:00
|
|
|
|
\Propel::setLogger($this->container->get('propel.logger'));
|
|
|
|
|
}
|
2011-04-05 21:21:05 +02:00
|
|
|
|
|
2011-04-06 18:19:13 +02:00
|
|
|
|
\Propel::initialize();
|
2011-04-13 18:14:49 +02:00
|
|
|
|
}
|
2011-01-22 16:15:43 +01:00
|
|
|
|
}
|
2012-04-20 15:24:52 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function build(ContainerBuilder $container)
|
|
|
|
|
{
|
|
|
|
|
parent::build($container);
|
|
|
|
|
|
|
|
|
|
if ($container->hasExtension('security')) {
|
|
|
|
|
$container->getExtension('security')->addUserProviderFactory(new PropelFactory('propel', 'propel.security.user.provider'));
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-10-28 14:41:03 +02:00
|
|
|
|
}
|