`Zend\ModuleManager\Feature\ProvidesDependencyModulesInterface` #3427

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

Comments

Projects
None yet
3 participants
Member

Ocramius commented Jan 14, 2013

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

weierophinney commented Jan 21, 2013

#3443 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment