set lib.doctrine = NULL to use php's include path, thx to jahir

This commit is contained in:
Steffen Vogel 2011-03-17 11:43:09 +01:00
parent fd6dc000d3
commit 855655931d
3 changed files with 10 additions and 5 deletions

View file

@ -43,7 +43,7 @@ require_once VZ_DIR . '/lib/Util/Configuration.php';
Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf');
$classLoaders = array(
new Util\ClassLoader('Doctrine', Util\Configuration::read('lib.doctrine')),
new Util\ClassLoader('Doctrine', (is_null(Util\Configuration::read('lib.doctrine')) ? 'Doctrine' : Util\Configuration::read('lib.doctrine')),
new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib')
);

View file

@ -47,11 +47,11 @@ class ClassLoader {
* If neither a namespace nor an include path is given, the ClassLoader will
* be responsible for loading all classes, thereby relying on the PHP include_path.
*
* @param string $ns The namespace of the classes to load.
* @param string $namespace The namespace of the classes to load.
* @param string $includePath The base include path to use.
*/
public function __construct($ns = NULL, $includePath = NULL) {
$this->namespace = $ns;
public function __construct($namespace = NULL, $includePath = NULL) {
$this->namespace = $namespace;
$this->includePath = $includePath;
}

View file

@ -47,7 +47,12 @@ class Configuration {
$values = self::$values;
foreach ($tree as $part) {
$values = $values[$part];
if (isset($values[$part])) {
$values = $values[$part];
}
else {
return NULL;
}
}
return $values;