You are here

function ldap_servers_update_8403 in Lightweight Directory Access Protocol (LDAP) 8.4

Convert basedn to array.

File

ldap_servers/ldap_servers.install, line 143

Code

function ldap_servers_update_8403() {
  $storage = \Drupal::service('entity_type.manager')
    ->getStorage('ldap_server');
  $servers = $storage
    ->getQuery()
    ->execute();

  /** @var \Drupal\ldap_servers\Entity\Server $server */
  foreach ($storage
    ->loadMultiple($servers) as $server) {
    $split = preg_split('/\\r\\n|\\r|\\n/', $server
      ->get('basedn'));
    $server
      ->set('basedn', $split);
    $server
      ->save();
  }
}