function AliasStorage::delete

Overrides AliasStorageInterface::delete

File

core/lib/Drupal/Core/Path/AliasStorage.php, line 162

Class

AliasStorage
Provides a class for CRUD operations on path aliases.

Namespace

Drupal\Core\Path

Code

public function delete($conditions) {
    $storage = $this->getPathAliasEntityStorage();
    $query = $storage->getQuery();
    // API functions should be able to access all entities regardless of access
    // restrictions. Those need to happen on a higher level.
    $query->accessCheck(FALSE);
    foreach ($conditions as $field => $value) {
        if ($field === 'source') {
            $field = 'path';
        }
        elseif ($field === 'pid') {
            $field = 'id';
        }
        $query->condition($field, $value, '=');
    }
    $result = $query->execute();
    $storage->delete($storage->loadMultiple($result));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.