Skip to content
Snippets Groups Projects
Commit 7e661ca9 authored by Thomas Seidl's avatar Thomas Seidl
Browse files

Issue #3247840 by drunken monkey: Added a hidden datasource option to disable...

Issue #3247840 by drunken monkey: Added a hidden datasource option to disable the direct SQL query "fast path" for initial entity tracking.
parent 4da2f384
No related branches found
No related tags found
No related merge requests found
Search API 1.x, dev (xxxx-xx-xx): Search API 1.x, dev (xxxx-xx-xx):
--------------------------------- ---------------------------------
- #3247840 by drunken monkey: Added a hidden datasource option to disable the
direct SQL query "fast path" for initial entity tracking.
Search API 1.25 (2022-07-18): Search API 1.25 (2022-07-18):
----------------------------- -----------------------------
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
sequence: sequence:
type: string type: string
label: 'A bundle machine name' label: 'A bundle machine name'
disable_db_tracking:
type: boolean
label: 'Do not use a database query for tracking'
languages: languages:
type: mapping type: mapping
label: 'Languages' label: 'Languages'
......
...@@ -649,7 +649,10 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface ...@@ -649,7 +649,10 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface
} }
} }
$this->setConfiguration($form_state->getValues()); // Make sure not to overwrite any options not included in the form (like
// "disable_db_tracking") by adding any existing configuration back to the
// new values.
$this->setConfiguration($form_state->getValues() + $this->configuration);
} }
/** /**
...@@ -790,7 +793,8 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface ...@@ -790,7 +793,8 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface
// on large data sets. This allows for better control over what tables are // on large data sets. This allows for better control over what tables are
// included in the query. // included in the query.
// If no base table is present, then perform an entity query instead. // If no base table is present, then perform an entity query instead.
if ($entity_type->getBaseTable()) { if ($entity_type->getBaseTable()
&& empty($this->configuration['disable_db_tracking'])) {
$select = $this->getDatabaseConnection() $select = $this->getDatabaseConnection()
->select($entity_type->getBaseTable(), 'base_table') ->select($entity_type->getBaseTable(), 'base_table')
->fields('base_table', [$entity_id]); ->fields('base_table', [$entity_id]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment