You are here

public static function State::loadByMachineName in Booking and Availability Management Tools for Drupal 8

Parameters

$machine_name:

File

modules/bat_event/src/Entity/State.php, line 71
Contains \Drupal\bat_event\Entity\State.

Class

State
Defines the State entity.

Namespace

Drupal\bat_event\Entity

Code

public static function loadByMachineName($machine_name) {
  $units = [];
  $query = \Drupal::entityQuery('state');
  $query
    ->condition('machine_name', $machine_name);
  $result = $query
    ->execute();
  if (count($result) > 0) {
    $states = State::loadMultiple(array_keys($result));
    return reset($states);
  }
  return FALSE;
}