Closed (fixed)
Project:
Ubercart
Version:
8.x-4.x-dev
Component:
Other
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2016 at 08:05 UTC
Updated:
22 Dec 2017 at 05:39 UTC
Jump to comment: Most recent
Comments
Comment #2
tr commentedThe Drupal core country_manager service is implemented by \Drupal\Core\Locale\CountryManager.php, which defines a constructor with the signature
public function __construct(ModuleHandlerInterface $module_handler)Ubercart overrides the country_manager service in order to provide more information than core can provide (core only has iso2 country code and country English short name, while Ubercart provides the same thing plus iso3 codes, iso numeric codes, iso2 zone codes and zone names).
Ubercart does not alter the first (and by default only) argument to the country_manger service which is of type ModuleHandlerInterface, but Ubercart does add a second argument to the country_manager service. It appears that the Address module also alters the country_manager service. However, the core Drupal country_manager service requires that the first argument to the CountryManager constructor is of type ModuleHandlerInterface.
Ubercart is doing the correct thing here. I don't know who is calling CountryManager with a first argument of DatabaseBackend instead of ModuleHandlerInterface, but this is not happening within Ubercart. If the Address module is redefining the arguments of the country_manager service (rather than simply adding additional arguments), then the Address module is doing the wrong thing.
But fundamentally I think this is a problem with core Drupal architecture, which doesn't allow multiple modules to supply the same service (in this case country_manager).
Comment #3
robertoguzman commentedis there any work around to have both services at the same time ?
Comment #4
kiwad commentedSeems to be a duplicated tasks from #2664092: Addresses
Comment #5
longwaveAddress calls setArguments() instead of addArgument(): http://cgit.drupalcode.org/address/tree/src/AddressServiceProvider.php
But, do we really need to override the original service? We could just provide a separate service, that injects the original to obtain the list?
Comment #6
robertoguzman commentedany update relate to address and ubercart module ?
Comment #7
robertoguzman commentedany solution to this issue ?
Comment #8
robertoguzman commentedComment #9
cbovard commentedHello All, Was there any updates to this bug. I am getting the same as above.
Thank you everyone.
Comment #10
tr commentedAs explained above, this is not an Ubercart bug. It's the Address module which improperly changes the arguments/signature of the core Drupal country_manager service. You should ask them to fix it.
Comment #11
dkre commentedThis isn't user error so I'm not sure I would mark this as a support request.
I'm not very familiar with services by shouldn't decorators be the solution here? Symfony | Lullabot | Phase2
If CommerceGuys are not doing things in the best way with Address then surely it is better for a fellow module maintainer to post the issue than a site builder like me with very little understanding of what's happening under the hood. A good issue description leads to a quicker response and the issue being descibed from developer to developer a resolution will always be easier.
I can definitely understand your frustrations, it's not fun when external parties break things, but this module is DOA right now.
Re #5
addDefinition() resolves arg 1 error but then arg 2 produces an error: must implement Drupal\Core\Entity\EntityTypeManagerInterface.
Comment #12
dkre commentedIssue submitted on Address issue queue
Comment #13
tr commentedIn response to this issue, the Address module stopped their incorrect overriding of the core country_manager service. See #2866521: Stop overriding CountryManager. So this should no longer be a problem.