EntityTestCompositeConstraint.php

Same filename in this branch
  1. 11.x core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php
Same filename in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCompositeConstraint.php
  2. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php
  3. 8.9.x core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCompositeConstraint.php
  4. 8.9.x core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php
  5. 10 core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCompositeConstraint.php
  6. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/EntityTestCompositeConstraint.php

Namespace

Drupal\entity_test\Entity

File

core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCompositeConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\entity_test\Entity;

use Drupal\Core\Entity\Attribute\ContentEntityType;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\entity_test\EntityTestForm;

/**
 * Defines a test class for testing composite constraints.
 */
class EntityTestCompositeConstraint extends EntityTest {
    
    /**
     * {@inheritdoc}
     */
    public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields = parent::baseFieldDefinitions($entity_type);
        $fields['name']->setDisplayOptions('form', [
            'type' => 'string',
            'weight' => 0,
        ]);
        $fields['type']->setDisplayOptions('form', [
            'type' => 'entity_reference_autocomplete',
            'weight' => 0,
        ]);
        return $fields;
    }

}

Classes

Title Deprecated Summary
EntityTestCompositeConstraint Defines a test class for testing composite constraints.

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