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

make 'listeners' key can be configured outside application.config.php #5612

Conversation

samsonasik
Copy link
Contributor

because in ZF2 Skeleton App use : Zend\Mvc\Application::init(require 'config/application.config.php')

@Ocramius
Copy link
Member

can you give more insight on what you are doing here?

@samsonasik
Copy link
Contributor Author

@Ocramius for example : I make module and has custom 'listeners' config on my module for specific purpose, and the 'listeners' key will not be called on serviceManager->get('Application')->bootstrap($listeners) on Zend\Mvc\Application::init because old $listeners is comes from application.config.php ( in ZF2 skeleton case ).

@blanchonvincent
Copy link
Contributor

@samsonasik Hmmm to avoid BC maybe we can have a merge with listeners from app config and listeners from modules config ?

@samsonasik
Copy link
Contributor Author

@blanchonvincent done ;). please let me know if I missed something ;)

$serviceManager = new ServiceManager(new Service\ServiceManagerConfig($smConfig));
$serviceManager->setService('ApplicationConfig', $configuration);
$serviceManager->get('ModuleManager')->loadModules();

$config = array_unique(array_merge($configuration, $serviceManager->get('Config')));
Copy link
Contributor

Choose a reason for hiding this comment

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

@samsonasik maybe can we merge only $configuration['listeners'] and $serviceManager->get('Config')['listeners'] it will be faster ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blanchonvincent done, now only merge with key 'listeners'

@blanchonvincent
Copy link
Contributor

👍


$configurationListeners = isset($configuration['listeners']) ? $configuration['listeners'] : array();
$config = $serviceManager->get('Config');
$configListeners = isset($config['listeners']) ? $config['listeners'] : array();
Copy link
Member

Choose a reason for hiding this comment

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

These variable names are very confusing. May I suggest $listenersFromAppConfig and $listenersFromConfigService instead?

@weierophinney weierophinney added this to the 2.3.0 milestone Mar 3, 2014
@samsonasik
Copy link
Contributor Author

@weierophinney done. fixed. please let me know if I missed something ;)

weierophinney added a commit that referenced this pull request Mar 4, 2014
….config

make 'listeners' key can be configured outside application.config.php
weierophinney added a commit that referenced this pull request Mar 4, 2014
@weierophinney
Copy link
Member

Merged to develop for release with 2.3.0.

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.

4 participants