"Drupal\geolocation_search_api\Plugin\views\argument\SearchApiLocationRadius" does not exist

Created on 1 June 2025, 5 months ago

Problem/Motivation

ReflectionException: Class
"Drupal\geolocation_search_api\Plugin\views\argument\SearchApiLocationRadius" does not
exist in
drupal-10.4.x/html/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php:139

Steps to reproduce

drush en geolocation_search_api

Source files have search_api_location_views class but the name of the module is geolocation_search_api.

The module and class path have to match right?

Proposed resolution

The Problem: Namespace Mismatch
Your file declares:

namespace Drupal\search_api_location_views\Plugin\views\argument;

but error says it is looking for this:
Drupal\geolocation_search_api\Plugin\views\argument\SearchApiLocationRadius

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

4.0

Component

Geolocation Field / Backend

Created by

πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @SocialNicheGuru
  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    Updated class names to match module name

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    Once this patch is applied, other errors show up in the module.

    ArgumentCountError: Too few arguments to function Drupal\Component\Plugin\Attribute\Plugin::__construct(), 0 passed in drupal-10.4.x/html/modules/contrib/geolocation/modules/geolocation_search_api/src/Plugin/views/argument/SearchApiLocationRadius.php on line 14 and at least 1 expected in Drupal\Component\Plugin\Attribute\Plugin->__construct() (line 25 of drupal-10.4.x/html/core/lib/Drupal/Component/Plugin/Attribute/Plugin.php

  • First commit to issue fork.
  • @christianadamski opened merge request.
  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany

    I used this issue to fix a lot of PHP issues, which is fine.

    But the issue you point out is a bit weirder. The files in questions are just copies of https://www.drupal.org/project/search_api_location β†’

    I think they should simply be deleted and instead that module required? Can you test that?

  • First commit to issue fork.
  • @hmdnawaz opened merge request.
  • πŸ‡΅πŸ‡°Pakistan hmdnawaz

    We have both search_api_location and geolocation modules installed.

    The submodule geolocation_search_api of geolocation have views plugins that uses the same namespaces as search_api_location_views.

    Therefore, in Drupal 11.2, we get the error on drush deploy, we get this error

    Fatal error: Cannot declare class Drupal\search_api_location_views\Plugin\views\argument\SearchApiLocationPoint, because the name is already in use in /va  
      r/                                                                                                                                                            
        www/web/modules/contrib/geolocation/modules/geolocation_search_api/src/Plugin/views/argument/SearchApiLocationPoint.php on line 16

    I have created a new MR, because I'm not sure if this belongs to MR # 110 or not. Please let me know if it should be in that MR.

  • πŸ‡΅πŸ‡°Pakistan hmdnawaz

    Patch for 4.0.0-beta2

  • Status changed to Needs review 3 months ago
  • @christianadamski opened merge request.
  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany

    Removed the conflicting files and added a dependency on search_api_location instead.

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

Production build 0.71.5 2024