/**
  * Extend the base query with the git backend's additional data in
  * {versioncontrol_git_operations}.
  *
  * @return SelectQuery
  */
 protected function buildQueryBase($ids, $conditions)
 {
     $query = parent::buildQueryBase($ids, $conditions);
     $alias = $this->addTable($query, 'versioncontrol_git_operations', 'vcgo', 'base.vc_op_id = vcgo.vc_op_id');
     $query->fields($alias, drupal_schema_fields_sql('versioncontrol_git_operations'));
     return $query;
 }
 /**
  * Extend the base query with the git backend's additional data in
  * {versioncontrol_git_operations}.
  *
  * @return SelectQuery
  */
 protected function buildQueryBase($ids, $conditions)
 {
     $query = parent::buildQueryBase($ids, $conditions);
     $alias = $query->leftJoin('versioncontrol_git_item_revisions', 'vcgir', 'base.item_revision_id = vcgir.item_revision_id');
     $query->fields($alias, drupal_schema_fields_sql('versioncontrol_git_item_revisions'));
     return $query;
 }
 /**
  * Builds the query to load the entity.
  *
  * @param array|null $ids
  *   An array of entity IDs, or NULL to load all entities.
  *
  * @return \Drupal\Core\Database\Query\Select
  *   A SelectQuery object for loading the entity.
  */
 protected function buildQuery($ids)
 {
     $query = $this->database->select($this->entityType->getBaseTable(), 'base');
     $query->addTag($this->entityTypeId . '_load_multiple');
     // Add fields from the {entity} table.
     $entity_fields = drupal_schema_fields_sql($this->entityType->getBaseTable());
     $query->fields('base', $entity_fields);
     if ($ids) {
         $query->condition("base.{$this->idKey}", $ids, 'IN');
     }
     return $query;
 }
 /**
  * Return the sync log associated with the provided event, if any.
  *
  * @param VersioncontrolEvent $event
  *   The event for which to load the sync log.
  *
  * @return stdClass $log
  *   The sync log object for the requested event object.
  */
 public function getEventSyncLog(VersioncontrolEvent $event)
 {
     if (empty($event->elid)) {
         throw new Exception('Cannot fetch a sync log for an event that has not yet been saved or processed.', E_ERROR);
     }
     $log = db_select('versioncontrol_sync_log', 'vsl')->fields('vsl', drupal_schema_fields_sql('versioncontrol_sync_log'))->condition('vsl.elid', $event->elid)->condition('vsl.repo_id', $this->repo_id)->execute()->fetchObject();
     // normalize values in the log object from simple strings
     $log->start = (double) $log->start;
     $log->end = empty($log->end) ? 0 : (double) $log->end;
     $log->cron = (int) $log->cron;
     $log->fullsync_failover = (int) $log->fullsync_failover;
     $log->slid = (int) $log->slid;
     $log->repo_id = (int) $log->repo_id;
     $log->elid = (int) $log->elid;
     return $log;
 }