You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.
publicfunctionget($key, $forceNew = false)
{
// Here we use alias to find raw data$raw = $this->getRaw($key);
// ignore...if ($raw['shared'])
{
// This key is 'foo.bar', but instance key is \Foo\Barif (!isset($this->instances[$key]) || $forceNew)
{
$this->instances[$key] = $raw['callback']($this);
}
return$this->instances[$key];
}
returncall_user_func($raw['callback'], $this);
}
The text was updated successfully, but these errors were encountered:
If we use
buildSharedObject()
to build an object named\Foo\Bar
, the instance will be:But if we add alias
foo.bar
to this key, when we get by alias$container->get('foo.bar');
, container will create two object and store it in instance:It because the
buildObject
use this closure, it will create new instance everytime called:I'm not sure what is the good way to fix it, so I just report this issue.
See
Container::get()
: https://github.com/joomla/joomla-framework/blob/staging/src/Joomla/DI/Container.php#L337The text was updated successfully, but these errors were encountered: