You are here

public function Schema::__construct in Schemata 8

Creates a Schema object.

Parameters

\Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface $entity_type: The Entity Type definition.

string $bundle: The Bundle data definition.

\Drupal\Core\TypedData\DataDefinitionInterface[] $properties: Typed data properties for the schema's initial creation.

1 call to Schema::__construct()
NodeSchema::__construct in src/Schema/NodeSchema.php
Creates a Schema object.
1 method overrides Schema::__construct()
NodeSchema::__construct in src/Schema/NodeSchema.php
Creates a Schema object.

File

src/Schema/Schema.php, line 68

Class

Schema
Schema class that describes a Drupal Entity or Entity Type.

Namespace

Drupal\schemata\Schema

Code

public function __construct(EntityDataDefinitionInterface $entity_type, $bundle = NULL, array $properties = []) {
  $this->entityType = $entity_type;
  $this->bundle = $bundle;
  $this
    ->addProperties($properties);

  // These cache tags seem like they are essential to Schema cache variation.
  // It is not clear how to verify these cache tags, or how to pull them from
  // the injected dependencies.
  $this
    ->addCacheableDependency((new CacheableMetadata())
    ->addCacheTags([
    'entity_bundles',
    'entity_field_info',
    'entity_types',
  ]));
  $this->metadata['title'] = $this
    ->createTitle($this
    ->getEntityTypeId(), $this
    ->getBundleId()) . ' Schema';
  $this->metadata['description'] = $this
    ->createDescription($this
    ->getEntityTypeId(), $this
    ->getBundleId());
}