The latest framework update to DI makes the code found here:
https://github.com/joomla/jissues/blob/framework/cli/CliApp/Command/TrackerCommand.php#L60
$this->logger = Container::retrieve('logger');
fail when running CLI code because of the use of $this here:
https://github.com/joomla/jissues/blob/framework/cli/CliApp/Service/LoggerProvider.php#L73
Can be fixed by making $quiet and $fileName public and calling statically but not sure that's the best approach. I'd prefer changing the original static I think.
Agreed to passing the container. You should get a fatal error cannot use
$this when not in object context, in LoggerProvider line 73, I think.
On Nov 3, 2013 6:17 PM, "Nikolai Plath" notifications@github.com wrote:
Can you state what the problem (error message) is ? I'm not getting any..
BTW.. I think we should pass around the container object and access its
non static methods instead.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/164#issuecomment-27657540
.
The static Container was really a way to just ease the transition a lot.
Proper DI with our system would be to have the container build a lot of
the classes and fill its dependencies, but I haven't quite gotten there
myself with the proper understanding of its use.
On Sunday, November 3, 2013, Nikolai Plath wrote:
Can you state what the problem (error message) is ? I'm not getting any..
BTW.. I think we should pass around the container object and access its
non static methods instead.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/164#issuecomment-27657540
.
I finally got us in sync with the Framework again and cleared out of our Container override the unnecessary methods (so it really is now a lazy static instance of the parent container, nothing more). The $this uses can be blamed on @dongilbert from when he was refactoring the providers, but we won't tell him that ;-)
You should get a fatal error cannot use $this when not in object context,
Could it be that you are using PHP 5.3 while I am running 5.4 ? IIRC there was some "behavior change"...
I had it too on my PHP 5.4 local.
Are we good here ? (never managed to reproduce this :( )
Can you state what the problem (error message) is ? I'm not getting any..
BTW.. I think we should pass around the container object and access its non static methods instead.