PaymentStorageSchema.php in Payment 8.2
File
src/Entity/Payment/PaymentStorageSchema.php
View source
<?php
namespace Drupal\payment\Entity\Payment;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
class PaymentStorageSchema extends SqlContentEntityStorageSchema {
protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
$schema = parent::getEntitySchema($entity_type, $reset);
$this
->alterEntitySchemaWithNonFieldColumns($schema);
return $schema;
}
protected function alterEntitySchemaWithNonFieldColumns(array &$schema) {
$schema['payment']['fields'] += array(
'current_payment_status_delta' => array(
'description' => "The {payment__payment_statuses}.delta of this payment's current status item.",
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => TRUE,
),
);
$schema['payment']['foreign keys'] += array(
'current_payment_status_delta' => array(
'table' => 'payment__payment_statuses',
'columns' => array(
'current_payment_status_delta' => 'delta',
),
),
'owner' => array(
'table' => 'user',
'columns' => array(
'owner' => 'uid',
),
),
);
}
}