class EntityTestMulChanged

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php \Drupal\entity_test\Entity\EntityTestMulChanged

Defines the test entity class.

Plugin annotation


@ContentEntityType(
  id = "entity_test_mul_changed",
  label = @Translation("Test entity - data table"),
  handlers = {
    "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
    "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
    "form" = {
      "default" = "Drupal\entity_test\EntityTestForm",
      "delete" = "Drupal\entity_test\EntityTestDeleteForm"
    },
    "route_provider" = {
      "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
    },
    "views_data" = "Drupal\views\EntityViewsData"
  },
  base_table = "entity_test_mul_changed",
  data_table = "entity_test_mul_changed_property",
  translatable = TRUE,
  entity_keys = {
    "id" = "id",
    "uuid" = "uuid",
    "bundle" = "type",
    "label" = "name",
    "langcode" = "langcode"
  },
  links = {
    "add-form" = "/entity_test_mul_changed/add",
    "canonical" = "/entity_test_mul_changed/manage/{entity_test_mul_changed}",
    "edit-form" = "/entity_test_mul_changed/manage/{entity_test_mul_changed}/edit",
    "delete-form" = "/entity_test/delete/entity_test_mul_changed/{entity_test_mul_changed}",
  },
  field_ui_base_route = "entity.entity_test_mul_changed.admin_form",
)

Hierarchy

Expanded class hierarchy of EntityTestMulChanged

3 files declare their use of EntityTestMulChanged
ContentEntityChangedTest.php in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
EntityReferenceRelationshipTest.php in core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php
SaveActionTest.php in core/tests/Drupal/KernelTests/Core/Action/SaveActionTest.php

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulChanged.php, line 47

Namespace

Drupal\entity_test\Entity
View source
class EntityTestMulChanged extends EntityTestMul implements EntityChangedInterface {
  use EntityChangedTrait;
  
  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['changed'] = BaseFieldDefinition::create('changed_test')->setLabel(t('Changed'))
      ->setDescription(t('The time that the entity was last edited.'))
      ->setTranslatable(TRUE);
    $fields['not_translatable'] = BaseFieldDefinition::create('string')->setLabel(t('Non translatable'))
      ->setDescription(t('A non-translatable string field'));
    return $fields;
  }
  
  /**
   * {@inheritdoc}
   */
  public function save() {
    // Ensure a new timestamp.
    sleep(1);
    return parent::save();
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.