laminas / laminas-modulemanager

Modular application system for laminas-mvc applications
https://docs.laminas.dev/laminas-modulemanager/
BSD 3-Clause "New" or "Revised" License
30 stars 18 forks source link

ModuleManager load module childs dependents #6

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/6239 User: @turrsis Created On: 2014-05-07T19:40:25Z Updated At: 2015-03-19T12:34:03Z Body Allow load modules (from Module::init()) after current module. Analog of https://github.com/zendframework/zf2/pull/5651, but: load modules A, B - configs order is A, B. load modules A -> B - configs order is A, B.


Comment

User: @Ocramius Created On: 2014-05-08T00:47:57Z Updated At: 2014-05-08T00:47:57Z Body

load modules A, B - configs order is A, B. load modules A -> B - configs order is A, B.

Could you clarify a bit?


Comment

User: @Ocramius Created On: 2014-07-28T00:25:09Z Updated At: 2014-07-28T00:25:09Z Body Assigning to @EvanDotPro for review


Comment

User: @adamlundrigan Created On: 2014-11-16T23:49:22Z Updated At: 2014-11-17T00:20:34Z Body What is the specific use case this is trying to solve? I've built a lot of ZF2 modules and I've never come across the need to dynamically load sub-modules like this. To me it adds an extra level of complexity to solve a problem that, in my view, doesn't really need fixing....but perhaps I'm missing the point. I guess it can be a bit annoying, for instance to install ZfcUser you have to remember to put both ZfcBase and ZfcUser in your list of loaded modules, but I've not found a need to work around that personally.


Comment

User: @turrsis Created On: 2014-11-20T09:43:02Z Updated At: 2014-11-20T09:43:02Z Body @adamlundrigan This is analog of the Zend\ModuleManager\Feature\DependencyIndicatorInterface - somebody use it


Comment

User: @Ocramius Created On: 2014-11-20T12:01:38Z Updated At: 2014-11-20T12:01:38Z Body Yes, though I would suggest reading #3443

The dependency indicator interface is just a pre-flight check that can be disabled, and it was implemented that way because loading separate modules automatically is a bit too magic (IMO).


Comment

User: @turrsis Created On: 2014-11-25T08:44:12Z Updated At: 2014-11-25T08:44:12Z Body This is inverse task of https://github.com/zendframework/zf2/pull/5651 Sometimes you may need load submodules imperatively, and main module settings should be overwriten by childrens.


Comment

User: @Ocramius Created On: 2014-11-27T01:18:01Z Updated At: 2014-11-27T01:18:01Z Body @turrsis yes, and I'm arguing that the use-case is very limited. I'll leave this up to @EvanDotPro: maybe this makes sense now that composer fits 95% of use-cases.


Comment

User: @Ocramius Created On: 2014-12-17T13:23:08Z Updated At: 2014-12-17T13:23:08Z Body @EvanDotPro can you review and state your opinion on this? I can handle the rebase/merge stuff myself if you like it.


Comment

User: @weierophinney Created On: 2015-02-09T21:41:01Z Updated At: 2015-02-09T21:41:01Z Body Not yet reviewed by @EvanDotPro , but it does need to be rebased if we do decide to merge.


Comment

User: @turrsis Created On: 2015-02-23T09:51:11Z Updated At: 2015-02-23T09:51:11Z Body @weierophinney rebased.


Comment

User: @weierophinney Created On: 2015-02-23T18:39:27Z Updated At: 2015-02-23T18:39:27Z Body @EvanDotPro Can you please review this and at the very least comment on whether you think we should merge or not?


Comment

User: @EvanDotPro Created On: 2015-03-18T14:53:21Z Updated At: 2015-03-18T14:53:21Z Body @turrsis So, this might be because I haven't taken enough time to understand the approach taken, but I just don't quite understand a couple things about this approach. First, it seems to hold an extra copy or reference to the ModuleEvent? Second, could you explain the changes around the loadFinished property? Overall, I understand and appreciate what you're trying to do (a delayed module-load), I'm just hung up on the implementation details at this point. /cc @weierophinney @Ocramius


Comment

User: @weierophinney Created On: 2015-03-18T15:00:30Z Updated At: 2015-03-18T15:00:30Z Body I'm going to delay this, then; I think we need more discussion of the feature.


Comment

User: @EvanDotPro Created On: 2015-03-18T15:13:56Z Updated At: 2015-03-18T15:13:56Z Body Sounds good. Sorry for the delay, @turrsis!


Comment

User: @turrsis Created On: 2015-03-19T12:34:03Z Updated At: 2015-03-19T12:34:03Z Body copy of the ModuleEvent : I don't understand this too :) , fixed. loadFinished : if you increment and decrement this variable - it should be integer



Originally posted by @GeeH at https://github.com/zendframework/zend-modulemanager/issues/47

weierophinney commented 4 years ago

Use-case: (probably same scenario)

I'm writing an academe system where I have two (2) interrelated modules Staff and Faculty (both are sub-component for Employees module - where abstract account setting resides).

Following are my module namespaces:

Is it best fit (practice) to use only the base namespace "Employees" in the modules.config.php file to include the Staff and Faculty module dependencies - since composer can traverse the module settings using getAutoloaderConfig() method?

I've tried to decouple Faculty module from Employees module because I need the faculty services only for FacultyTeachingLoad module and ClassScheduling module - both are deployed on a separate application.

Any thoughts about this approach or some advice on how to properly structure it. Thanks.


Originally posted by @gabbydgab at https://github.com/zendframework/zend-modulemanager/issues/47#issuecomment-236325721