function StringDatabaseStorage::dbStringLoad

Same name in other branches
  1. 9 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringLoad()
  2. 8.9.x core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringLoad()
  3. 10 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::dbStringLoad()

Loads multiple string objects.

Parameters

array $conditions: Any of the conditions used by dbStringSelect().

array $options: Any of the options used by dbStringSelect().

string $class: Class name to use for fetching returned objects.

Return value

\Drupal\locale\StringInterface[] Array of objects of the class requested.

2 calls to StringDatabaseStorage::dbStringLoad()
StringDatabaseStorage::getStrings in core/modules/locale/src/StringDatabaseStorage.php
StringDatabaseStorage::getTranslations in core/modules/locale/src/StringDatabaseStorage.php

File

core/modules/locale/src/StringDatabaseStorage.php, line 320

Class

StringDatabaseStorage
Defines a class to store localized strings in the database.

Namespace

Drupal\locale

Code

protected function dbStringLoad(array $conditions, array $options, $class) {
    $strings = [];
    $result = $this->dbStringSelect($conditions, $options)
        ->execute();
    foreach ($result as $item) {
        
        /** @var \Drupal\locale\StringInterface $string */
        $string = new $class($item);
        $string->setStorage($this);
        $strings[] = $string;
    }
    return $strings;
}

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