Problem/Motivation
When installing the module, the following errorwill appear:
You have requested a non-existent service "subman.sync"
The reason behind this is, that any module using subman, has to implement a "subman.sync" service. The "subman.sync" service declared in subman is only an abstract class with the method declarations and a few implementations. Leading to the service not existing without a module implementing the service extending the SubmanSync abstract class.
This surely isn't the way on how services should be used in Drupal and should be fixed accordingly.
Steps to reproduce
Install the module.
Proposed resolution
Fix the issue.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork subman-3366160
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anybody@Grevil: Thank you, we should take a look at this together. I'd be even happier to hear from @danielnolde about the idea behind.
Comment #3
anybody@Grevil: Assigning to you as reminder.
Comment #4
anybodyThis is definitely a misconception in the module, as the "subman" module is a dependency of the implementing modules, like "Billwerk". To install Billwerk, it's required to install Subman, which isn't possible due to this error.
So whatever is the reason here, has to be reengineered or fixed.
This is critical, as it makes Billwerk and Subman uninstallable!
Comment #5
grevil commentedOk, this is not easy to figure out.
First thought, was to define the subman.sync service in subman and mark it as an abstract service. But subman calls the services internally, and we can not instantiate an abstract service. Furthermore instantiating the billwerk service directly in subman wouldn't make sense at all.
My next thought was, to flag the service as "syntetic", so we would instantiate it during runtime, ONLY when billwerk is already installed: https://symfony.com/doc/current/service_container/synthetic_services.html. But this would lead to a hard dependency on billwerk inside subman, which we do not want (since it is the other way around).
Comment #6
grevil commentedI'd say this needs some major refactor, otherwise we could simply ignore the error, since it is installable (although errors get thrown).
Comment #7
anybodyWe need to use service decoration here, I think. subman.sync service should *never* be defined in Billwerk. That's the wrong namespace.
See:
https://www.previousnext.com.au/blog/decorated-services-drupal-8
Comment #9
grevil commentedDone, works great with the changes in #3370380: Installation error: ServiceNotFoundException: You have requested a non-existent service "subman.sync"!
Please review.
Comment #10
grevil commentedComment #11
anybodyWell done! Merging in combination with #3370380: Installation error: ServiceNotFoundException: You have requested a non-existent service "subman.sync"
Comment #13
anybody