Fix the following error:

  • BadMethodCallException: The "\Drupal\cloud\Controller\CloudConfigLocationController::access" method is not callable as a _custom_access callback in route "/clouds/cloud_config_location" in Drupal\Core\Access\CustomAccessCheck->access() (line 69 of /var/www/html/web/cloud-test-warnings/web/core/lib/Drupal/Core/Access/CustomAccessCheck.php)
  • Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "geocoder". in Drupal\Component\DependencyInjection\Container->get() (line 153 of /var/www/html/web/cloud-testing/web/core/lib/Drupal/Component/DependencyInjection/Container.php)

Comments

jigish.addweb created an issue. See original summary.

jigish.addweb’s picture

Status: Active » Needs review
StatusFileSize
new2.82 KB
baldwinlouie’s picture

Status: Needs review » Needs work

@jigish.addweb, Thank you for this patch. It looks good. I have one comment below.

+++ b/src/Controller/CloudConfigLocationController.php
@@ -69,15 +61,12 @@ class CloudConfigLocationController extends ControllerBase {
   /**

@@ -88,8 +77,7 @@ class CloudConfigLocationController extends ControllerBase {
     );

@@ -275,7 +263,7 @@ class CloudConfigLocationController extends ControllerBase {
+      $locations = \Drupal::service('geocoder')->geocode($address, [$provider]);

Can you please add a comment stating why we can't use dependency injection? I'm afraid in the future, someone might try to refactor this and we will end up with the same bug again.

jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new2.94 KB
yas’s picture

StatusFileSize
new2.88 KB

@jigishaddweb
@baldwin

I slightly changed the wording for the comment based on Jigish's patch. Please review it.

baldwinlouie’s picture

Status: Needs review » Reviewed & tested by the community

@all The patch looks good.

yas’s picture

@baldwinlouie

Thank you for your review. I'll merge the patch to 8.x-2.x and close this issue as Fixed.

  • yas committed 8a874e6 on 8.x-2.x authored by jigish.addweb
    Issue #3099267 by jigish.addweb, yas, baldwinlouie: Fix the error of non...
yas’s picture

Status: Reviewed & tested by the community » Fixed
Related issues: +#3095569: Composer could not parse version constraint / could not load package (2)

Status: Fixed » Closed (fixed)

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