EntityTestConstraints.php
Same filename in other branches
Namespace
Drupal\entity_test\EntityFile
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Entity/ EntityTestConstraints.php
View source
<?php
declare (strict_types=1);
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines a test class for testing the definition of entity level constraints.
*
* @ContentEntityType(
* id = "entity_test_constraints",
* label = @Translation("Test entity constraints"),
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "bundle" = "type",
* "label" = "name"
* },
* base_table = "entity_test_constraints",
* persistent_cache = FALSE,
* constraints = {
* "NotNull" = {}
* }
* )
*/
class EntityTestConstraints extends EntityTest implements EntityChangedInterface {
use EntityChangedTrait;
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['changed'] = BaseFieldDefinition::create('changed')->setLabel(t('Changed'));
return $fields;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
EntityTestConstraints | Defines a test class for testing the definition of entity level constraints. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.