You are here

IssueStorage.php in Drupal PM (Project Management) 4.x

Namespace

Drupal\pm_issue

File

modules/pm_issue/src/IssueStorage.php
View source
<?php

namespace Drupal\pm_issue;

use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Session\AccountInterface;
use Drupal\pm_issue\Entity\IssueInterface;

/**
 * Defines the storage handler class for Issue entities.
 *
 * This extends the base storage class, adding required special handling for
 * Issue entities.
 *
 * @ingroup pm_issue
 */
class IssueStorage extends SqlContentEntityStorage implements IssueStorageInterface {

  /**
   * {@inheritdoc}
   */
  public function revisionIds(IssueInterface $entity) {
    return $this->database
      ->query('SELECT vid FROM {pm_issue_revision} WHERE id=:id ORDER BY vid', [
      ':id' => $entity
        ->id(),
    ])
      ->fetchCol();
  }

  /**
   * {@inheritdoc}
   */
  public function userRevisionIds(AccountInterface $account) {
    return $this->database
      ->query('SELECT vid FROM {pm_issue_field_revision} WHERE uid = :uid ORDER BY vid', [
      ':uid' => $account
        ->id(),
    ])
      ->fetchCol();
  }

}

Classes

Namesort descending Description
IssueStorage Defines the storage handler class for Issue entities.