public function HeartbeatEntityQuery::orConditionGroup in Heartbeat 8
Creates a new group of conditions ORed together.
For example, consider a map entity with an 'attributes' field containing 'building_type' and 'color' columns. To find all green and red bikesheds:
$query = \Drupal::entityQuery('map');
$group = $query
->orConditionGroup()
->condition('attributes.color', 'red')
->condition('attributes.color', 'green');
$entity_ids = $query
->condition('attributes.building_type', 'bikeshed')
->condition($group)
->execute();
Note that this particular example can be simplified:
$entity_ids = $query
->condition('attributes.color', array(
'red',
'green',
))
->condition('attributes.building_type', 'bikeshed')
->execute();
Return value
\Drupal\Core\Entity\Query\ConditionInterface
Overrides QueryInterface::orConditionGroup
File
- src/
HeartbeatEntityQuery.php, line 380
Class
- HeartbeatEntityQuery
- Created by IntelliJ IDEA. User: logicp Date: 5/28/17 Time: 1:37 PM
Code
public function orConditionGroup() {
// TODO: Implement orConditionGroup() method.
}