Propel: problem with loading configuration variables
Posted: Tue Nov 14, 2006 10:58 am
The Propel.php has a public static method to load configuration files into the static variable: $configuration
it uses a include line which will actually load an array from a configuration file which is actually returned.
but this line does not work as expected here in php.net example
the config file
the line that calls the following code
the actual code in Propel.php file
so in the above function, configFile is the path to the configuration file.
when it executes the include line, it does not move to the next line in the function and no error is reported as well.
i do see that line can be
Any ideas why return is not working...
it uses a include line which will actually load an array from a configuration file which is actually returned.
but this line does not work as expected here in php.net example
Code: Select all
return.php
<?php
$var = 'PHP';
return $var;
?>
noreturn.php
<?php
$var = 'PHP';
?>
testreturns.php
<?php
$foo = include 'return.php';
echo $foo; // prints 'PHP'
$bar = include 'noreturn.php';
echo $bar; // prints 1
?>Code: Select all
<?php
// This file generated by Propel convert-props target on Tue Nov 14 16:33:05 2006
// from XML runtime conf file /var/www/test/bookstore/runtime-conf.xml [EDITED]
return array (
'log' =>
array (
'ident' => 'propel-bookstore',
'level' => '7',
));
?>Code: Select all
Propel::init( '/var/www/test/bookstore/build/conf/bookstore-conf.php' );Code: Select all
public static function configure($configFile)
{
self::$configuration = include($configFile);
if (self::$configuration === false) {
throw new PropelException("Unable to open configuration file: " . var_export($configFile, true));
}
}when it executes the include line, it does not move to the next line in the function and no error is reported as well.
i do see that line can be
Code: Select all
include $configFile instead of include($configFile) and I have tried the other format but it does not work.