TestEntityController.php 670 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
<?php

/**
 * @file
 * Definition of Drupal\field_test\TestEntityController.
 */

namespace Drupal\field_test;

10 11
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\EntityInterface;
12 13 14 15 16 17 18

/**
 * Controller class for the test entity entity types.
 */
class TestEntityController extends DatabaseStorageController {

  /**
19
   * Overrides Drupal\Core\Entity\DatabaseStorageController::preSaveRevision().
20
   */
21 22 23 24
  public function preSaveRevision(array &$record, EntityInterface $entity) {
    // Allow for predefined revision ids.
    if (!empty($record['use_provided_revision_id'])) {
      $record['ftvid'] = $record['use_provided_revision_id'];
25 26 27 28
    }
  }

}