Problem/Motivation
The following code in my custom module:
$query = Drupal::entityQuery('node')
->condition('type', 'some_type')
->notExists("field_some_field.1");
$ids = $query->execute();
throws such notice:
Notice: Undefined offset: 2 in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 129 of core\lib\Drupal\Core\Entity\Query\Sql\Tables.php).
I can see that there is an incrementation right before the line throwing the notice.
So in my case the $key was equal = 0, it's incremeting to the 1, and the line $next = $specifiers[$key + 1];
is trying to get the nonexistent specifier (thare are only 2 of them).
This code was comitted recently in #2384459: Add entity query condition for delta in EFQ and I guess it wasn't tested properly with $delta as the final specifier in condition.
Comments
Comment #2
BerdirI don't think this kind of condition is supported at the moment
Querying on the delta is documented on the other patch as a condition('some_field.%delta', 5) to make sure that there are at least N items. you're tryin to do the opposite, I don't know if that works. Looking at the last example:
Maybe you can do something like that and then for the second condition, do a not exists.
Comment #3
pingwin4egWhether it's supported or not, but it works, if not pay attention to the Notice.
And you are right - the
->notExists("field_some_field.1.value")
works too resulting in the same underlying query. I don't know why I didn't try it first.