Problem :
I need filtering entities based on the value of a multiple-choice field.
I want my query returns all entities except those who have a given value ('doe
' for this example).
Actual :
multiple-choice values
foo|Choice 1
bar|Choice 2
doe|Choice 3
MyController.php
$nodeStorage = \Drupal:::entityManager()->getStorage('node');
$nids = $nodeStorage->getQuery()
->condition('type', 'order')
->execute();
$entities = $nodeStorage->loadMultiple($nids);
Need :
So I need something like below :
$nodeStorage = \Drupal:::entityManager()->getStorage('node');
$nids = $nodeStorage->getQuery()
->condition('type', 'order')
->condition('field_multiple_choice', '!=', 'doe')
->execute();
$entities = $nodeStorage->loadMultiple($nids);
How can I do ? Thank you in advance.