You are here

function zoomapi_meeting_get_meeting_for_entity in Zoom API 7

Get Meeting for Entity.

Parameters

object $entity: The entity the meeting is being created for.

string $entity_type: The type (node, user, etc.) of entity.

Return value

array An array of the meeting setup.

File

./zoomapi.module, line 516
Main file for the Zoom API module.

Code

function zoomapi_meeting_get_meeting_for_entity($entity, $entity_type) {
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
  $sql = 'SELECT data FROM {zoomapi_meeting_tracker}';
  $sql .= ' WHERE entity_type = :entity_type';
  $sql .= ' AND entity_id = :entity_id';

  // We only expect a single record for any entity_type/entity_id. Just in case
  // that is a false assumption, sort by the created date DESC so we grab the
  // most recent record.
  $sql .= ' ORDER BY created DESC';
  $sql_args = [
    ':entity_type' => $entity_type,
    ':entity_id' => $entity_id,
  ];
  if ($data = db_query($sql, $sql_args)
    ->fetchField()) {
    return unserialize($data);
  }
  return [];
}