[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jfw] Container and use of an alias

If you set a container key with alias for example:
$c->set('MyApp\\Interfaces\\App\\AppResponseInterface', [$this, 'getResponse'], true, true)
  ->alias('jresponse', 'MyApp\\Interfaces\\App\AppResponseInterface');
and you're using the long key in one function and the alias in another, the container will end up with 2 instances (long key/alias key) that maybe differ.
I expect to get the same instance here and to only get a new one if I set the second argument of the container get function(forceNew) to true,
is that a false expectation?
If not, adding $key = $this->resolveAlias($key); at the begining of the get method would solve that problem.

Framework source code: https://github.com/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.