class ViewsEntitySchemaSubscriber implements EntityTypeListenerInterface, EventSubscriberInterface (View source)

Reacts to changes on entity types to update all views entities.

Traits

Helper methods for EntityTypeListenerInterface.

Constants

BASE_TABLE_RENAME

Indicates that a base table got renamed.

DATA_TABLE_RENAME

Indicates that a data table got renamed.

DATA_TABLE_ADDITION

Indicates that a data table got added.

DATA_TABLE_REMOVAL

Indicates that a data table got removed.

REVISION_TABLE_RENAME

Indicates that a revision table got renamed.

REVISION_TABLE_ADDITION

Indicates that a revision table got added.

REVISION_TABLE_REMOVAL

Indicates that a revision table got removed.

REVISION_DATA_TABLE_RENAME

Indicates that a revision data table got renamed.

REVISION_DATA_TABLE_ADDITION

Indicates that a revision data table got added.

REVISION_DATA_TABLE_REMOVAL

Indicates that a revision data table got removed.

Properties

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

protected LoggerInterface $logger

The default logger service.

Methods

static array
getEntityTypeEvents()

Gets the subscribed events.

onEntityTypeEvent(EntityTypeEvent $event, string $event_name)

Listener method for any entity type definition event.

onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, array $field_storage_definitions)

{@inheritdoc}

onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original)

Reacts to the update of the entity type.

onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array $sandbox = NULL)

{@inheritdoc}

onEntityTypeDelete(EntityTypeInterface $entity_type)

Reacts to the deletion of the entity type.

__construct(EntityTypeManagerInterface $entity_type_manager, LoggerInterface $logger)

Constructs a ViewsEntitySchemaSubscriber.

static array
getSubscribedEvents()

{@inheritdoc}

processHandlers(array $all_views, callable $process)

Applies a callable onto all handlers of all passed in views.

baseTableRename(View[] $all_views, string $entity_type_id, string $old_base_table, string $new_base_table)

Updates views if a base table is renamed.

dataTableRename(View[] $all_views, string $entity_type_id, string $old_data_table, string $new_data_table)

Updates views if a data table is renamed.

dataTableAddition(View[] $all_views, EntityTypeInterface $entity_type, string $new_data_table, string $base_table)

Updates views if a data table is added.

dataTableRemoval(View[] $all_views, string $entity_type_id, string $old_data_table, string $base_table)

Updates views if a data table is removed.

revisionRemoval(View[] $all_views, EntityTypeInterface $original)

Updates views if revision support is removed.

Details

static array getEntityTypeEvents()

Gets the subscribed events.

Return Value

array

An array of subscribed event names.

See also

\Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()

onEntityTypeEvent(EntityTypeEvent $event, string $event_name)

Listener method for any entity type definition event.

Parameters

EntityTypeEvent $event

The field storage definition event object.

string $event_name

The event name.

onEntityTypeCreate(EntityTypeInterface $entity_type)

{@inheritdoc}

Parameters

EntityTypeInterface $entity_type

onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, array $field_storage_definitions)

{@inheritdoc}

Parameters

EntityTypeInterface $entity_type
array $field_storage_definitions

onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original)

Reacts to the update of the entity type.

Parameters

EntityTypeInterface $entity_type

The updated entity type definition.

EntityTypeInterface $original

The original entity type definition.

onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array $sandbox = NULL)

{@inheritdoc}

Parameters

EntityTypeInterface $entity_type
EntityTypeInterface $original
array $field_storage_definitions
array $original_field_storage_definitions
array $sandbox

onEntityTypeDelete(EntityTypeInterface $entity_type)

Reacts to the deletion of the entity type.

Parameters

EntityTypeInterface $entity_type

The entity type being deleted.

__construct(EntityTypeManagerInterface $entity_type_manager, LoggerInterface $logger)

Constructs a ViewsEntitySchemaSubscriber.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

LoggerInterface $logger

A logger instance.

static array getSubscribedEvents()

{@inheritdoc}

Return Value

array

protected processHandlers(array $all_views, callable $process)

Applies a callable onto all handlers of all passed in views.

Parameters

array $all_views

All views entities.

callable $process

A callable which retrieves a handler config array.

protected baseTableRename(View[] $all_views, string $entity_type_id, string $old_base_table, string $new_base_table)

Updates views if a base table is renamed.

Parameters

View[] $all_views

All views.

string $entity_type_id

The entity type ID.

string $old_base_table

The old base table name.

string $new_base_table

The new base table name.

protected dataTableRename(View[] $all_views, string $entity_type_id, string $old_data_table, string $new_data_table)

Updates views if a data table is renamed.

Parameters

View[] $all_views

All views.

string $entity_type_id

The entity type ID.

string $old_data_table

The old data table name.

string $new_data_table

The new data table name.

protected dataTableAddition(View[] $all_views, EntityTypeInterface $entity_type, string $new_data_table, string $base_table)

Updates views if a data table is added.

Parameters

View[] $all_views

All views.

EntityTypeInterface $entity_type

The entity type.

string $new_data_table

The new data table.

string $base_table

The base table.

protected dataTableRemoval(View[] $all_views, string $entity_type_id, string $old_data_table, string $base_table)

Updates views if a data table is removed.

Parameters

View[] $all_views

All views.

string $entity_type_id

The entity type ID.

string $old_data_table

The name of the previous existing data table.

string $base_table

The name of the base table.

protected revisionRemoval(View[] $all_views, EntityTypeInterface $original)

Updates views if revision support is removed.

Parameters

View[] $all_views

All views.

EntityTypeInterface $original

The origin entity type.