You are here

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

Namespace

Drupal\pm_invoice

File

modules/pm_invoice/src/InvoiceStorage.php
View source
<?php

namespace Drupal\pm_invoice;

use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Session\AccountInterface;
use Drupal\pm_invoice\Entity\InvoiceInterface;

/**
 * Defines the storage handler class for Invoice entities.
 *
 * This extends the base storage class, adding required special handling for
 * Invoice entities.
 *
 * @ingroup pm_invoice
 */
class InvoiceStorage extends SqlContentEntityStorage implements InvoiceStorageInterface {

  /**
   * {@inheritdoc}
   */
  public function revisionIds(InvoiceInterface $entity) {
    return $this->database
      ->query('SELECT vid FROM {pm_invoice_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_invoice_field_revision} WHERE uid = :uid ORDER BY vid', [
      ':uid' => $account
        ->id(),
    ])
      ->fetchCol();
  }

}

Classes

Namesort descending Description
InvoiceStorage Defines the storage handler class for Invoice entities.