I am working on a old project change request and the project was developed in phalcon 1.2.6 verson. When I am trying to execute the application the application returns an error. After doing some R&D I found that the system did not find the config key from the $di
object.
When I am trying to print the $di
object it's printing properly with key config. But when trying to access the config key, I am unable to access it.
When the system tries to execute the below code, it throws an exception.
$di = \Phalcon\DI::getDefault();
print_r($di['config']);
I am getting the below error.
Invalid service definition. Missing 'className' parameter
#0 [internal function]: Phalcon\DI\Service\Builder->build(Object(Phalcon\DI\FactoryDefault), Array, NULL)
#1 [internal function]: Phalcon\DI\Service->resolve(NULL, Object(Phalcon\DI\FactoryDefault))
#2 [internal function]: Phalcon\DI->get('config', NULL)
#3 /var/www/sites/mfs_merged/apps/api/Module.php(44): Phalcon\DI->offsetGet('config')
#4 [internal function]: AppServer\Api\Module->registerServices(Object(Phalcon\DI\FactoryDefault))
#5 /var/www/sites/mfs_merged/public/index.php(64): Phalcon\Mvc\Application->handle()
#6 {main}
below is a part of my $di
object
Phalcon\DI\FactoryDefault Object
(
[_services:protected] => Array
(
[...] => Phalcon\DI\Service Object
(....)
[config] => Phalcon\DI\Service Object
(
[_name:protected] => config
[_definition:protected] => Array
(
[database] => Array
(
[adapter] => Oracle
[host] => 172.20.3.228
[username] => XXXXX
[password] => XXXXXXX
[schema] => XE
[dbname] => (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.3.228)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
)
[memcache] => Array
(
[lifetime] => 3600
[host] => localhost
[port] => 11211
[persistent] =>
)
[soapClient] => Array
(
[connectionTimeout] => 60
[exceptions] =>
[trace] => 1
[cache] => 0
[useSoapHeader] => 1
[soapHeader] => Array
(
[username] => XXXXX
[password] => XXXXXX
)
)
[SMSCodesLogPath] => /var/www/sites/mfs_merged/config/TZ/../../public/files/_SMSTokens/tokens_TZ.log
)
[_shared:protected] => 1
[_sharedInstance:protected] =>
)
)
[_sharedInstances:protected] => Array
(.....)
[_freshInstance:protected] => 1
)