From 0038fb4fc69e3be39b8f472af405f7381bde53ef Mon Sep 17 00:00:00 2001 From: idimopoulos Date: Mon, 18 Sep 2017 23:47:19 +0200 Subject: [PATCH] Add a temporary fix for the storage config. --- src/Entity/Query/Sparql/SparqlCondition.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Entity/Query/Sparql/SparqlCondition.php b/src/Entity/Query/Sparql/SparqlCondition.php index 136d4a11..abd4a429 100644 --- a/src/Entity/Query/Sparql/SparqlCondition.php +++ b/src/Entity/Query/Sparql/SparqlCondition.php @@ -255,6 +255,16 @@ public function condition($field = NULL, $value = NULL, $operator = NULL, $lang $field_name_parts = explode('.', $field); $field = $field_name_parts[0]; $column = isset($field_name_parts[1]) ? $field_name_parts[1] : $this->fieldHandler->getFieldMainProperty($this->query->getEntityTypeId(), $field); + + // @todo: This should maybe throw an exception instead. That blocks the + // creation of new fields though because the field storage config class + // validated the form by checking counting the values in the database. + // For now, return without adding the condition in this case. + // @see: \Drupal\field_ui\Form\FieldStorageConfigEditForm::validateCardinality + if (!$this->fieldHandler->hasFieldPredicate($this->query->getEntityTypeId(), $field, $column, $this->entityBundle)) { + return $this; + } + $this->conditions[] = [ 'field' => $field, 'value' => $value,