mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
refactor configuration
This commit is contained in:
@@ -40,7 +40,7 @@ class Core extends \Pimple
|
|||||||
*/
|
*/
|
||||||
private $configuration;
|
private $configuration;
|
||||||
|
|
||||||
public function __construct($environnement)
|
public function __construct($environement = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,11 +49,14 @@ class Core extends \Pimple
|
|||||||
static::initAutoloads();
|
static::initAutoloads();
|
||||||
|
|
||||||
|
|
||||||
/**
|
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||||
* Init conf
|
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||||
*/
|
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||||
$this->init($environnement);
|
);
|
||||||
|
$this->configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||||
|
|
||||||
|
$this->configuration->setEnvironnement($environement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set version
|
* Set version
|
||||||
*/
|
*/
|
||||||
@@ -65,10 +68,10 @@ class Core extends \Pimple
|
|||||||
/**
|
/**
|
||||||
* Set Entity Manager using configuration
|
* Set Entity Manager using configuration
|
||||||
*/
|
*/
|
||||||
$configuration = $this->getConfiguration();
|
$doctrineConf = $this->configuration->getDoctrine()->all();
|
||||||
$this['EM'] = $this->share(function() use ($configuration)
|
$this['EM'] = $this->share(function() use ($doctrineConf)
|
||||||
{
|
{
|
||||||
$doctrine = new Core\Service\Doctrine($configuration->getDoctrine());
|
$doctrine = new Core\Service\Doctrine($doctrineConf);
|
||||||
return $doctrine->getEntityManager();
|
return $doctrine->getEntityManager();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -410,19 +413,5 @@ class Core extends \Pimple
|
|||||||
return $this->conf->getEnvironnement();
|
return $this->conf->getEnvironnement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load application configuration
|
|
||||||
*
|
|
||||||
* @param type $env
|
|
||||||
*/
|
|
||||||
private function loadConf($env)
|
|
||||||
{
|
|
||||||
$confHandler = new Configuration\Handler(
|
|
||||||
new Configuration\Application(),
|
|
||||||
new Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->configuration = new Configuration($env, $confHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user