-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
|
||
$config = $serviceLocator->get('Config'); | ||
|
||
$keyPath = explode('.', $pluginManager->getConfigKeyPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"/" makes more sense to me as it's a path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check that plugin manager implements ConfigKeyProviderInterface, and if not, raise an exception like "MissingConfigPathException".
Add ZF3 plz. This brings a lot of BC. As I told you on IRC, I like this idea. It avoids writing a lot of factories that look the same, make the framework a bit easier to understand, and remove the ugly ModuleListener thing. |
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\ServiceManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be Zend\Stdlib. This way Options classes can also implement this interface, and create a generic factory for them too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with evan, we should not enforce the use of the options manager.
Thus using it is completely optional.
Forgot some files Incorporating feedback in IRC from @bakura10 Added the di configuration back The plugin manager factory should actually configure the pluginManager not just set the config More work Replacing factories with an abstract one Added the options factory Removed obsolete factories Implements ProvidesConfigKeyPathInterface Throw exception on invalid configuration Fixed two typoes Added the options manager Cleaned up a bit Added the view helpers Removed the invokable versions of the helpers Typo
{ | ||
$className = array_search($name, $serviceLocator->getCanonicalNames()); | ||
|
||
if ($className === false || !class_exists($className)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about if ($className instanceof AbstractPluginManager) { return true; } ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey ? You made it work earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it return true, not the same as having it actually work 😠 but then as you said if we write a compiler then this is a micro optimization that is not really worth spending much time on
$keyPath = $pluginManager->getConfigKeyPath(); | ||
|
||
foreach (explode('/', $keyPath) as $p) { | ||
if (isset($config[$p])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep consistency :
if (!isset($config[$p])) {
/// exception
}
$config = $config[$p];
Currently this is only some experimenting where i wish feedback!