You are here

public function PartyDataBase::getEntityIds in Party 8.2

Get entity ids/deltas

This allows you to get the entity ids and deltas of all the entities without having to load them. There may also be sub entities, in which case the value for that delta will be an empty string, as to not throw a warning if the array is flipped.

Return value

array Array of entity ids keyed by delta. Unsaved entities return an empty string.

1 call to PartyDataBase::getEntityIds()
PartyDataBase::getEntityDelta in lib/Drupal/party/Plugin/PartyDataBase.php
Get the delta from an entity object.

File

lib/Drupal/party/Plugin/PartyDataBase.php, line 266
Contains \Drupal\party\Plugin\PartyDataBase.

Class

PartyDataBase
Class PartyDataBase

Namespace

Drupal\party\Plugin

Code

public function getEntityIds() {
  $ids = array();
  foreach ($this->entities as $delta => $entity) {
    if (!$entity
      ->isNew()) {
      $ids[$delta] = $entity->is_stub ? $entity->id : $entity
        ->id();
    }
    else {

      // This is unsaved, so we use an empty string so warnings don't get
      // emitted on an array_flip().
      $ids[$delta] = '';
    }
  }
  return $ids;
}