Enhancement Request: Add OR Conditions Support and Storage Plugin Access for External Entities

Created on 14 May 2024, 8 months ago
Updated 23 May 2024, 8 months ago

Problem/Motivation

Currently, the External Entities module supports only AND conditions for querying data in external entity storage. This limitation restricts the flexibility required for more complex queries that involve OR conditions. Additionally, there is no direct access to the associated storage plugin from the external entity, which limits the usage of custom methods implemented in custom storage plugins.

In our implementation, we have developed a custom external entity storage plugin that retrieves data from a SOAP service, which allows SQL queries to be executed on a SQL Server 2019 database. We have implemented several methods in this custom storage plugin that are essential for overcoming the limitations of the default external entities storage.

Steps to reproduce

  1. Create an external entity storage plugin.
  2. Attempt to add OR conditions in a query while retrieving data.
  3. Notice the limitations in handling OR conditions with the current implementation.
  4. Attempt to access custom methods in the associated storage plugin from the external entity.

Proposed resolution

  1. Support for OR Conditions: Add functionality to handle OR conditions in external entity storage queries. This would involve updating the query builder to support OR operations.
  2. Access to Storage Plugin: Allow external entities to access their associated storage plugin directly. This would enable the utilization of custom methods implemented in custom storage plugins.

Remaining tasks

  1. Review and discuss the feasibility of supporting OR conditions in the external entity storage.
  2. Implement and test the OR conditions handling in the external entity storage.
  3. Allow access to the associated storage plugin from the external entity.
  4. Document the new features and provide examples or use cases.

User interface changes

No significant user interface changes are anticipated. However, documentation and possible updates to the administrative interface for configuring queries might be required.

API changes

New API methods or changes to existing methods to support OR conditions and expose the associated storage plugin to the external entity.

Data model changes

No data model changes are anticipated.

Feature request
Status

Active

Component

Code

Created by

🇪🇸Spain psf_ Huelva

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

Comments & Activities

  • Issue created by @psf_
  • 🇫🇷France guignonv

    Is it a feature you want in v2? I think it might require breaking changes (in the structure of $parameters passed to storage client query() and countQuery()) and may fit better for v3.

  • 🇫🇷France guignonv

    Regarding v3, current dev now supports both OR and AND conditions as well as complex queries with sub-queries. However, complex field paths (ie. 'field_location.entity:node.field_tag.entity:taxonomy_term') are not handled at the moment but it is not a priority.

    Regarding the second request about "Access to Storage Plugin", it is already possible with this:
    $xentity->getExternalEntityType()->getStorageClient()

    I don't think its useful to have a shortcut $xentity->getStorageClient() because the storage client does not belong to an external entity but rather to all external entities of a given type: it belongs to the external entity type which is already the case and makes sens IMHO. The storage configuration is handled by the external entity type as well. So when you want to access to the storage client of an external entity, passing through the external entity type reminds that its something handled by the xntt type. Other opinions?

Production build 0.71.5 2024