Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

[ZF3] Feature/options manager #5055 #5059

Closed
wants to merge 1 commit into from
Closed

[ZF3] Feature/options manager #5055 #5059

wants to merge 1 commit into from

Conversation

awartoft
Copy link
Contributor

@awartoft awartoft commented Sep 1, 2013

Currently this is only some experimenting where i wish feedback!

@awartoft
Copy link
Contributor Author

awartoft commented Sep 1, 2013

#5055


$config = $serviceLocator->get('Config');

$keyPath = explode('.', $pluginManager->getConfigKeyPath());
Copy link
Contributor

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.

Copy link
Contributor

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".

@bakura10
Copy link
Contributor

bakura10 commented Sep 1, 2013

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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)) {
Copy link
Contributor

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; } ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not possible

Copy link
Contributor

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.

Copy link
Contributor Author

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

@awartoft awartoft closed this Sep 25, 2013
$keyPath = $pluginManager->getConfigKeyPath();

foreach (explode('/', $keyPath) as $p) {
if (isset($config[$p])) {
Copy link
Contributor

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];

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants