You are here

function ldap_query_update_8301 in Lightweight Directory Access Protocol (LDAP) 8.4

Updates bind method to new value.

File

ldap_query/ldap_query.install, line 15

Code

function ldap_query_update_8301() {
  $query = \Drupal::entityQuery('ldap_query_entity');
  $ids = $query
    ->execute();
  $entities = QueryEntity::loadMultiple($ids);

  /** @var \Drupal\ldap_query\Entity\QueryEntity $entity */
  foreach ($entities as $entity) {
    switch ($entity
      ->get('scope')) {
      case 1:
        $entity
          ->set('scope', 'base');
        break;
      case 2:
        $entity
          ->set('scope', 'one');
        break;
      case 3:
        $entity
          ->set('scope', 'sub');
        break;
    }
    $entity
      ->save();
  }
}