You are here

public function SessionBasedTempStore::getAll in Session Based Temporary Storage 8

Retrieves an array of all values from this PrivateTempStore.

Return value

array The array of key => value data or empty array.

Throws

\Drupal\Core\TempStore\TempStoreException

1 call to SessionBasedTempStore::getAll()
SessionBasedTempStore::deleteAll in src/SessionBasedTempStore.php
Deletes all data from the store for the current collection and owner.

File

src/SessionBasedTempStore.php, line 149

Class

SessionBasedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\session_based_temp_store

Code

public function getAll() {
  $values = [];
  $owner = $this
    ->getOwner();
  $objects = $this->storage
    ->getAll();
  if (!empty($objects)) {
    foreach ($objects as $key => $object) {
      if ($object->owner == $owner) {
        $key = explode(':', $key);
        $values[$key[1]] = $object->data;
      }
    }
  }
  return $values;
}