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

Command icon 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

Grevil created an issue. See original summary.

anybody’s picture

@Grevil: Thank you, we should take a look at this together. I'd be even happier to hear from @danielnolde about the idea behind.

anybody’s picture

Assigned: Unassigned » grevil

@Grevil: Assigning to you as reminder.

anybody’s picture

Priority: Normal » Critical

This 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!

grevil’s picture

Status: Active » Needs work

Ok, 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).

grevil’s picture

Assigned: grevil » Unassigned

I'd say this needs some major refactor, otherwise we could simply ignore the error, since it is installable (although errors get thrown).

anybody’s picture

Assigned: Unassigned » grevil

We 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

grevil’s picture

Assigned: grevil » Unassigned
Status: Needs work » Needs review
anybody’s picture

Status: Needs review » Reviewed & tested by the community

  • Anybody committed 8fc4e85f on 1.0.x authored by Grevil
    Issue #3366160: Error:  You have requested a non-existent service "...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.