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

Zend\ModuleManager\Feature\ProvidesDependencyModulesInterface #3427

Closed
Ocramius opened this issue Jan 14, 2013 · 2 comments
Closed

Zend\ModuleManager\Feature\ProvidesDependencyModulesInterface #3427

Ocramius opened this issue Jan 14, 2013 · 2 comments
Assignees
Milestone

Comments

@Ocramius
Copy link
Member

I'd suggest a new interface that would allow modules to define dependency modules as follows:

namespace Zend\ModuleManager\Feature;

interface ProvidesDependencyModulesInterface
{
    /** @return array */
    public function getDependencyModules();
}

While this would look like an overkill (and probably should be disabled in production systems, or when i.e. merged config is cached and available), it would reduce problems with users having trouble because of scrambled module order or forgotten modules.

namespace MyApp;

namespace Zend\ModuleManager\Feature;

class Module implements ProvidesDependencyModulesInterface
{
    public function getDependencyModules()
    {
         return array('OcraLoremModule', 'DoctrineModule');
    }
}

This shouldn't cause any "magic loading", but just ensure that OcraLoremModule and DoctrineModule are loaded before this one. If not, the ModuleManager should an exception.
That's self-documenting and aids the end user in getting started real quick.

Ping @EvanDotPro

@akomm
Copy link

akomm commented Jan 14, 2013

I like this suggestion.

  • Its optional, since you dont have to implement this interface.
  • Specific feedback (Exception) can save a lot of time.

@weierophinney
Copy link
Member

#3443 merged.

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

No branches or pull requests

3 participants