Undefined property 'config'
Issue #3
resolved
The problem
Warning: Phalcon\DI\Injectable::__get(): Access to undefined property config in ~\src\ModDev\PhalconLocale\PhalconLocale.php on line 83
Catchable fatal error: Argument 2 passed to ModDev\PhalconLocale\PhalconLocale::installMeetsMinimumRequirements() must be an instance of Phalcon\Config, null given, called in ~\src\ModDev\PhalconLocale\PhalconLocale.php on line 83 and defined in ~\src\ModDev\PhalconLocale\PhalconLocale.php on line 276
More details
This is my ::urlRedirect()
:
ModDev\PhalconLocale\PhalconLocale::urlRedirect($di, $localeConfigurations);
This is my $localeConfigurations
:
$localeConfigurations = new Phalcon\Config([
'locale' => [
'localeBasedRedirect' => true,
'defaultLocale' => 'en_US',
'sessionKey' => 'applocale',
'doubleCheckBrowserDefaultLangs' => true,
'useGeoIP' => false,
'availableLocales' => [
'pt',
'pt-BR',
'en',
'en-US'
]
]
]);
And this is my dependency injection:
$di->set('locale', function () {
return new PhalconLocale;
},
true
);
The question
What's wrong?
Comments (5)
-
repo owner -
reporter Beautiful, Mark. I'm waiting the next version, hehe.
Hope that I help your library.
Mentioning that (the library), there is something new about the implementation in the main PhalconPHP framework?
I'm very excited to see this kick-ass way to make an application speak multi-languages working seamlessly for everyone, every time.
-
repo owner I've put in a fix and now have a 1.1 tag for it. You should be able to pass any \Phalcon\Config object, with the proper keys, to either the static function, or the class itself.
-
repo owner - changed status to on hold
Waiting user feedback
-
reporter - changed status to resolved
- Log in to comment
It would appear that I'm taking a shortcut that I should not in the __construct() function. It works if you have:
set up so as $this->config is pulling the config from the DI container as opposed to being, you know, injected like it should be. Give me a day to put out 1.1 with a fix for that. Once you go to 1.1 will also have to change the locale service to be:
I'll have to figure how to make this so it doesn't break backwards compatibility. Ug.