You are here

public static function BrightcoveSubscription::loadMultipleByApiClient in Brightcove Video Connect 8.2

Same name and namespace in other branches
  1. 8 src/Entity/BrightcoveSubscription.php \Drupal\brightcove\Entity\BrightcoveSubscription::loadMultipleByApiClient()
  2. 3.x src/Entity/BrightcoveSubscription.php \Drupal\brightcove\Entity\BrightcoveSubscription::loadMultipleByApiClient()

Load Subscriptions for a given API client.

Parameters

\Drupal\brightcove\Entity\BrightcoveAPIClient $api_client: Loaded API client.

Return value

\Drupal\brightcove\Entity\BrightcoveSubscription[] Returns loaded Brightcove Subscription entity objects keyed by ID or an empty array if there are none.

1 call to BrightcoveSubscription::loadMultipleByApiClient()
BrightcoveAPIClientDeleteForm::submitForm in src/Form/BrightcoveAPIClientDeleteForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Entity/BrightcoveSubscription.php, line 324

Class

BrightcoveSubscription
Defines the Brightcove Subscription entity.

Namespace

Drupal\brightcove\Entity

Code

public static function loadMultipleByApiClient(BrightcoveAPIClient $api_client) {

  /** @var \Drupal\Core\Database\Connection $connection */
  $connection = \Drupal::getContainer()
    ->get('database');
  $brightcove_subscriptions = $connection
    ->select('brightcove_subscription', 'bs')
    ->fields('bs')
    ->condition('api_client_id', $api_client
    ->id())
    ->execute()
    ->fetchAllAssoc('id', \PDO::FETCH_ASSOC);
  $loaded_brightcove_subscriptions = [];
  foreach ($brightcove_subscriptions as $id => $brightcove_subscription) {
    $brightcove_subscription['events'] = unserialize($brightcove_subscription['events']);
    $loaded_brightcove_subscriptions[$id] = BrightcoveSubscription::createFromArray($brightcove_subscription);
  }
  return $loaded_brightcove_subscriptions;
}