0
[dev]
great.url="www.google.com"
[test : dev]
great.url="www.yahoo.com"
[prod : test]
great.url="www.aol.com"

I have my own functions which return the Config of the environment that is used(DEV,TEST,OR PROD) . Now my problem is $myclassinstance->getConfig()->great->url; (when i say this it is returning url correctly in dev) where as in test it is returning notice "Notice: Trying to get property of non-object in file test.php on line no 19" this error is coming due to empty of this statement ($myclassinstance->getConfig()->great->url;).it is returning correctly in dev . What might be the problem.

Charles
  • 50,943
  • 13
  • 104
  • 142
Someone
  • 10,405
  • 23
  • 67
  • 100

1 Answers1

1

It must be defaulting to dev. To fix it, you need to do something like this:

$config = new Zend_Config_Ini('/path/to/config.ini', 'prod');
$myclassinstance->setConfig($config);

or depending on how you have things setup:

$myclassinstance->config = $config;

Then your code should work:

$myclassinstance->getConfig()->great->url;

Documentation is here: http://framework.zend.com/manual/en/zend.config.adapters.ini.html

lo_fye
  • 6,790
  • 4
  • 33
  • 49