class ConfigEntityRevisionsRevisionStorageHandler in Config Entity Revisions 8.2
Class ConfigEntityRevisionsRevisionStorageHandler.
@package Drupal\config_entity_revisions\Entity
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityStorageBase implements EntityHandlerInterface, EntityStorageInterface
- class \Drupal\Core\Entity\ContentEntityStorageBase implements ContentEntityStorageInterface, DynamicallyFieldableEntityStorageInterface uses DeprecatedServicePropertyTrait
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage implements EntityBundleListenerInterface, DynamicallyFieldableEntityStorageSchemaInterface, SqlEntityStorageInterface
- class \Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsRevisionStorageHandler implements ConfigEntityRevisionsRevisionStorageHandlerInterface
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage implements EntityBundleListenerInterface, DynamicallyFieldableEntityStorageSchemaInterface, SqlEntityStorageInterface
- class \Drupal\Core\Entity\ContentEntityStorageBase implements ContentEntityStorageInterface, DynamicallyFieldableEntityStorageInterface uses DeprecatedServicePropertyTrait
- class \Drupal\Core\Entity\EntityStorageBase implements EntityHandlerInterface, EntityStorageInterface
Expanded class hierarchy of ConfigEntityRevisionsRevisionStorageHandler
1 file declares its use of ConfigEntityRevisionsRevisionStorageHandler
- config_entity_revisions.module in ./
config_entity_revisions.module - Config entity revisions procedural hooks.
File
- src/
Entity/ Handler/ ConfigEntityRevisionsRevisionStorageHandler.php, line 29
Namespace
Drupal\config_entity_revisions\Entity\HandlerView source
class ConfigEntityRevisionsRevisionStorageHandler extends SqlContentEntityStorage implements ConfigEntityRevisionsRevisionStorageHandlerInterface {
/**
* The config entity being used.
*
* @var \Drupal\config_entity_revisions\Entity\ConfigEntityRevisions
*/
protected $configEntity;
/**
* An array containing the statuses of revisions for this entity.
*
* @var array
*/
protected $revisionStates = NULL;
/**
* The serialiser service.
*
* @var \Symfony\Component\Serializer\Serializer
*/
protected $serialiser = NULL;
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountProxyInterface
*/
protected $currentUser = NULL;
/**
* The date time service.
*
* @var \Drupal\Component\Datetime\Time
*/
protected $dateTimeService = NULL;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
/**
* Constructs a ConfigEntityRevisionsRevisionStorageHandler class instance.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
* @param \Drupal\Core\Database\Connection $database
* The database connection to be used.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
* The cache backend to be used.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface|null $memory_cache
* The memory cache backend to be used.
* @param \Symfony\Component\Serializer\Serializer $serialiser
* The serialiser service instance.
* @param \Drupal\Core\Session\AccountProxyInterface $current_user
* The current user object.
* @param \Drupal\Component\Datetime\Time $date_time
* The date/time service.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityManagerInterface $entity_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache = NULL, Serializer $serialiser, AccountProxyInterface $current_user, Time $date_time, EntityTypeBundleInfo $bundle_info, EntityTypeManager $entity_type_manager) {
parent::__construct($entity_type, $database, $entity_manager, $cache, $language_manager, $memory_cache, $bundle_info, $entity_type_manager);
$this->serialiser = $serialiser;
$this->currentUser = $current_user;
$this->dateTimeService = $date_time;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static($entity_type, $container
->get('database'), $container
->get('entity.manager'), $container
->get('cache.entity'), $container
->get('language_manager'), $container
->get('entity.memory_cache'), $container
->get('serializer'), $container
->get('current_user'), $container
->get('datetime.time'), $container
->get('entity_type.bundle.info'), $container
->get('entity_type.manager'));
}
/**
* Set the config entity under consideration.
*
* @param \Drupal\config_entity_revisions\Entity\ConfigEntityRevisionsConfigEntityInterface $configEntity
* The config_entity_revisions entity.
*/
public function setConfigEntity(ConfigEntityRevisionsConfigEntityInterface $configEntity) {
$this->configEntity = $configEntity;
}
/**
* Populate the revision states array.
*/
protected function ensureRevisionStatesLoaded() {
if (is_null($this->revisionStates)) {
$this->revisionStates = $this->database
->select("config_entity_revisions_revision", 'c')
->fields('c', [])
->condition($this->entityType
->getKey('id'), $this->configEntity
->getContentEntityID())
->orderby('revision', 'DESC')
->execute()
->fetchAll();
}
}
/**
* Gets the latest published revision ID of the entity.
*
* @param int $ignore
* A revision ID to ignore (optional).
*
* @return int
* The identifier of the latest published revision of the entity, or NULL
* if the entity does not have a published revision.
*/
public function getLatestPublishedRevisionId($ignore = NULL) {
$this
->ensureRevisionStatesLoaded();
foreach ($this->revisionStates as $state) {
if (!is_null($ignore) && $state->revision == $ignore) {
continue;
}
if ($state->published) {
return $state->revision;
}
}
return NULL;
}
/**
* Gets the latest published revision ID of the entity.
*
* @param int $ignore
* A revision ID to ignore (optional).
*
* @return int
* The identifier of the latest published revision of the entity, or NULL
* if the entity does not have a published revision.
*/
public function getLatestPublishedRevision($ignore = NULL) {
$revision = NULL;
$revision_id = $this
->getLatestPublishedRevisionId($ignore);
if ($revision_id) {
$revision = $this
->loadRevision($revision_id);
}
return $revision;
}
/**
* Gets the latest revision ID of the entity.
*
* @param int $ignore
* A revision ID to ignore (optional).
*
* @return int
* The identifier of the latest published revision of the entity, or NULL
* if the entity does not have a published revision.
*/
public function getLatestRevisionId($ignore = NULL) {
$this
->ensureRevisionStatesLoaded();
return empty($this->revisionStates) ? NULL : $this->revisionStates[0]->revision;
}
/**
* Gets the latest revision of the entity.
*
* @param int $ignore
* A revision ID to ignore (optional).
*
* @return int
* The identifier of the latest published revision of the entity, or NULL
* if the entity does not have a published revision.
*/
public function getLatestRevision($ignore = NULL) {
$id = $this
->getLatestRevisionId($ignore);
return $id ? $this
->loadRevision($id) : NULL;
}
/**
* Gets the latest revision ID of the entity.
*
* @param int $ignore
* A revision ID to ignore (optional).
*
* @return int
* The identifier of the latest published revision of the entity, or NULL
* if the entity does not have a published revision.
*/
public function getLatestPublishedRevisionOrLatestId($ignore = NULL) {
$revision_id = $this
->getLatestPublishedRevisionId($ignore);
return $revision_id ? $revision_id : $this
->getLatestRevisionId($ignore);
}
/**
* Get a Config Entity instance from Content Entity Revision.
*
* @param \Drupal\config_entity_revisions\Entity\ConfigEntityRevisions $content_entity
* The ConfigEntityRevisions entity instance.
*
* @return \Drupal\config_entity_revisions\Entity\ConfigEntityRevisions
* The deserialised config entity.
*/
public function getConfigEntity(ConfigEntityRevisions $content_entity, $class = '') {
if ($class == '') {
if (!$this->configEntity) {
throw new Exception('No class name or instance suppled to ConfigEntityRevisionsRevisionStorageHandler::getConfigEntity');
}
$class = get_class($this->configEntity);
}
$config_entity = $this->serialiser
->deserialize($content_entity
->get('configuration')->value, $class, 'json');
// The result of serialising and then deserialising is not an exact
// copy of the original. This causes problems downstream if we don't fix
// a few attributes here.
$config_entity
->set('settingsOriginal', $config_entity
->get('settings'));
$config_entity
->set('enforceIsNew', FALSE);
$config_entity->loadedRevisionId = $content_entity
->getRevisionId();
if ($config_entity->moderation_state) {
$config_entity->moderation_state->value = $content_entity->moderation_state->value;
}
return $config_entity;
}
/**
* Create an initial revision record.
*
* @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
* The configuration entity.
*
* @return \Drupal\Core\Entity\ContentEntityInterface|null
* The content entity created.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function createInitialRevision(ConfigEntityRevisionsConfigEntityInterface $config_entity) {
$contentID = $config_entity
->getContentEntityID();
// Already created.
if ($contentID) {
return NULL;
}
// Make a content revisions entity using either the previous version of
// the config entity or (failing that) the current version.
// We're doing this here rather than in the update hook because we want
// to save the reference to the entity config entity version that is being
// saved now.
/* @var $originalEntity ConfigEntityInterface */
$originalEntity = $config_entity
->contentEntityStorage()
->load($config_entity
->id());
$source = $originalEntity ? $originalEntity : $config_entity;
$bundle_type = $config_entity
->getBundleName();
/* @var $contentEntity ContentEntityInterface */
$contentEntity = $config_entity
->contentEntityStorage()
->create([
'form' => $source
->get('uuid'),
'configuration' => $this->serialiser
->serialize($source, 'json'),
'revision_user' => $this->currentUser
->id(),
'revision_creation_time' => $this->dateTimeService
->getRequestTime(),
'revision_log_message' => 'Original revision.',
'moderation_state' => 'draft',
'type' => $bundle_type,
]);
$contentEntity
->save();
$contentID = $contentEntity
->id();
$config_entity
->setContentEntityID($contentID);
$config_entity
->save();
return $contentEntity;
}
/**
* Create revision when a new config entity version is saved.
*
* @param \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface $config_entity
* The configuration entity.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function createUpdateRevision(ConfigEntityRevisionsConfigEntityInterface $config_entity) {
/* @var $revisionsEntity \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface */
$revisionsEntity = NULL;
$previous_state = FALSE;
$moderated = FALSE;
if (!empty($config_entity
->getRevisionId())) {
$revisionsEntity = $config_entity
->contentEntityStorage()
->loadRevision($config_entity
->getRevisionID());
$moderated = $revisionsEntity
->hasField('moderation_state');
if ($moderated) {
$previous_state = $revisionsEntity->moderation_state->value;
}
}
else {
$contentID = $config_entity
->getContentEntityID();
if (is_null($contentID)) {
// No related content entity yet.
return;
}
$revisionsEntity = $config_entity
->contentEntityStorage()
->load($contentID);
}
$revisionsEntity
->set('configuration', $this->serialiser
->serialize($config_entity, 'json'));
$revisionsEntity
->setRevisionUserId($this->currentUser
->id());
$revisionsEntity
->setRevisionCreationTime($this->dateTimeService
->getRequestTime());
$new_message = $config_entity
->get('revision_log_message')[0]['value'];
$new_revision = $config_entity
->get('revision');
$moderation_state = $moderated ? $config_entity->moderation_state->value : NULL;
$published = NULL;
if (!is_null($moderation_state)) {
$published = $moderation_state == 'published';
}
if (is_null($moderation_state) && is_null($new_revision)) {
$new_revision = FALSE;
}
if (!is_null($new_message)) {
$revisionsEntity
->setRevisionLogMessage($config_entity
->get('revision_log_message')[0]['value']);
}
$revisionsEntity
->setNewRevision($new_revision);
if (!is_null($moderation_state)) {
$revisionsEntity->moderation_state = $moderation_state;
}
if (!is_null($published)) {
if ($published) {
$revisionsEntity
->setPublished();
}
else {
$revisionsEntity
->setUnpublished();
}
// @TODO Published <> default?
$revisionsEntity
->isDefaultRevision($published);
}
$revisionsEntity
->save();
if (($previous_state == 'published') !== $published) {
// Modify another revision to be published and default if possible.
$this
->resetDefaultRevision($revisionsEntity);
}
return $revisionsEntity
->getRevisionId();
}
/**
* Make default the most recently published or most recent revision.
*
* This is needed because content_moderation has a concept of a default
* revision, which this module doesn't really care about, but which will
* cause problems if we attempt to delete a revision that's marked as the
* default.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $content_entity
* The content (revisions) entity.
* @param int $deleting
* An optional revision ID that is about to be deleted.
*/
public function resetDefaultRevision(ContentEntityInterface $content_entity, $deleting = NULL) {
$content_entity_id = $content_entity
->id();
// Ensure our data is up to date after a save.
$this->revisionStates = NULL;
$this
->ensureRevisionStatesLoaded();
$first_published = NULL;
$first_revision = NULL;
$remove_default = [];
foreach ($this->revisionStates as $revision) {
if (!$first_revision && $revision->revision != $deleting) {
$first_revision = $revision;
}
if ($revision->published && !$first_published && $revision->revision != $deleting) {
$first_published = $revision;
}
if ($revision->revision_default) {
$remove_default[$revision->revision] = 1;
}
}
$default_revision = $first_published ?: $first_revision;
if ($default_revision) {
unset($remove_default[$default_revision->revision]);
}
if (!empty($remove_default)) {
$this->database
->update("config_entity_revisions_revision")
->condition('revision', array_keys($remove_default), 'IN')
->fields([
'revision_default' => 0,
])
->execute();
}
if ($default_revision) {
$this->database
->update("config_entity_revisions")
->condition('id', $content_entity_id)
->fields([
'revision' => $default_revision->revision,
])
->execute();
if ($this->database
->schema()
->tableExists('content_moderation_state_field_revision')) {
$content_moderation_rev_ids = $this->database
->select('content_moderation_state_field_revision', 'c')
->condition('content_entity_type_id', 'config_entity_revisions')
->condition('content_entity_id', $content_entity_id)
->condition('content_entity_revision_id', $default_revision->revision)
->fields('c', [
'id',
'revision_id',
])
->execute()
->fetchAssoc();
$this->database
->update('content_moderation_state')
->condition('id', $content_moderation_rev_ids['id'])
->fields([
'revision_id' => $content_moderation_rev_ids['revision_id'],
])
->execute();
}
}
}
/**
* Get a list of revision IDs for a content entity.
*/
public function getRevisionIds($content_entity_id) {
$revisions = $this->connection
->select("config_entity_revisions_revision", 'c')
->fields('c', [
'revision',
])
->condition('id', $content_entity_id)
->orderBy('revision', 'DESC')
->execute()
->fetchCol();
return $revisions;
}
/**
* Delete a single revision.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $revision
* The revision to be deleted.
*/
public function deleteSingleRevision(ContentEntityInterface $revision) {
$was_default = $revision
->isDefaultRevision();
if ($was_default) {
// Change the default to the next newer (if we're deleting the default,
// there must be no published revisions so it doesn't matter which we
// choose. Ensure revision_default isn't set on our revision in
// config_entity_revisions_revision - $was_default can return FALSE
// even when that value is 1, and that will cause the content moderation
// module (which does look at that field) to throw an exception.
$revisions = $this
->getRevisionIds($revision
->id());
$revision_to_use = $revisions[0] == $revision
->getRevisionId() ? $revisions[1] : $revisions[0];
$new_default = $this->entityTypeManager
->getStorage('config_entity_revisions')
->loadRevision($revision_to_use);
$new_default
->enforceIsNew(FALSE);
$new_default
->isDefaultRevision(TRUE);
$new_default
->save();
$content_moderation_state_storage = $this->entityTypeManager
->getStorage('content_moderation_state');
if ($content_moderation_state_storage) {
$content_moderation_ids = $content_moderation_state_storage
->getQuery()
->allRevisions()
->condition('content_entity_type_id', 'config_entity_revisions')
->condition('content_entity_revision_id', $revision_to_use)
->execute();
// Revision default is whether the revision WAS default when created.
// The content moderation module doesn't provide a method to update the
// default revision so we need to do a direct update query and clear
// caches.
$target_entity_type = $this->entityTypeManager
->getDefinition('content_moderation_state');
$this->connection
->update($target_entity_type
->getBaseTable())
->condition('id', array_values($content_moderation_ids)[0])
->fields([
'revision_id' => array_keys($content_moderation_ids)[0],
])
->execute();
$content_moderation_state_storage
->resetCache();
}
}
$this->entityTypeManager
->getStorage('config_entity_revisions')
->deleteRevision($revision
->getRevisionId());
}
/**
* Delete revisions when a config entity is deleted.
*
* @param ConfigEntityRevisionsConfigEntityInterface $config_entity
* The configuration entity being deleted.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function deleteRevisions(ConfigEntityRevisionsConfigEntityInterface $config_entity) {
$contentEntity = $config_entity
->getContentEntity();
if ($contentEntity) {
$config_entity
->contentEntityStorage()
->delete([
$contentEntity,
]);
}
}
/**
* Load a particular revision of a config entity.
*
* @param int $revision
* The revision ID to load.
* @param mixed $entity
* The entity type to load.
*
* @return mixed
* The loaded revision or NULL.
*/
public function loadConfigEntityRevision($revision = NULL, $entity = '') {
$config_entity_name = $this
->configEntityName();
if (!$entity) {
$match = \Drupal::service('router')
->matchRequest(\Drupal::request());
$entity = $match[$config_entity_name];
}
if (is_string($entity)) {
$entity = $this->entityTypeManager
->getStorage($config_entity_name)
->load($entity);
}
if ($revision) {
$revisionsEntity = $this->entityTypeManager
->getStorage('config_entity_revisions')
->loadRevision($revision);
$entity = \Drupal::getContainer()
->get('serializer')
->deserialize($revisionsEntity
->get('configuration')->value, get_class($entity), 'json');
// The result of serialising and then deserialising is not an exact
// copy of the original. This causes problems downstream if we don't fix
// a few attributes here.
$entity
->set('settingsOriginal', $entity
->get('settings'));
$entity
->set('enforceIsNew', FALSE);
}
return $entity;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | property | The config entity being used. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | property | The current user. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | property | The date time service. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | property | An array containing the statuses of revisions for this entity. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | property | The serialiser service. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Create an initial revision record. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides SqlContentEntityStorage:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Create revision when a new config entity version is saved. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Delete revisions when a config entity is deleted. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Delete a single revision. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
protected | function | Populate the revision states array. | |
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Get a Config Entity instance from Content Entity Revision. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Gets the latest published revision ID of the entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Gets the latest published revision ID of the entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Gets the latest revision ID of the entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Gets the latest revision of the entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Gets the latest revision ID of the entity. Overrides ContentEntityStorageBase:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Get a list of revision IDs for a content entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Load a particular revision of a config entity. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Make default the most recently published or most recent revision. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Set the config entity under consideration. Overrides ConfigEntityRevisionsRevisionStorageHandlerInterface:: |
|
ConfigEntityRevisionsRevisionStorageHandler:: |
public | function |
Constructs a ConfigEntityRevisionsRevisionStorageHandler class instance. Overrides SqlContentEntityStorage:: |
|
ContentEntityStorageBase:: |
protected | property | The entity bundle key. | |
ContentEntityStorageBase:: |
protected | property | Cache backend. | |
ContentEntityStorageBase:: |
protected | property | ||
ContentEntityStorageBase:: |
protected | property | The entity field manager service. | |
ContentEntityStorageBase:: |
protected | property | The entity bundle info. | |
ContentEntityStorageBase:: |
protected | property | Stores the latest revision IDs for entities. | |
ContentEntityStorageBase:: |
protected | function | Ensures integer entity key values are valid. | |
ContentEntityStorageBase:: |
public | function |
Creates a new revision starting off from the specified entity object. Overrides TranslatableRevisionableStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Constructs a new entity translation object, without permanently saving it. Overrides TranslatableStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Creates an entity with sample field values. Overrides ContentEntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Delete a specific entity revision. Overrides EntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
protected | function |
Performs storage-specific creation of entities. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
protected | function |
Performs storage-specific entity deletion. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function |
Performs post save entity processing. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
protected | function |
Performs presave entity processing. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
protected | function |
Performs storage-specific saving of the entity. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Gets entities from the persistent cache backend. | |
ContentEntityStorageBase:: |
public | function |
Returns the latest revision affecting the specified translation. Overrides TranslatableRevisionableStorageInterface:: |
|
ContentEntityStorageBase:: |
protected | function | Returns an array of field names to skip when merging revision translations. | |
ContentEntityStorageBase:: |
protected | function | Checks whether the field values changed compared to the original entity. | |
ContentEntityStorageBase:: |
protected | function | Initializes field values. | |
ContentEntityStorageBase:: |
protected | function | Invokes a method on the Field objects within an entity. | |
ContentEntityStorageBase:: |
protected | function | Invokes the post save method on the Field objects within an entity. | |
ContentEntityStorageBase:: |
protected | function |
Invokes a hook on behalf of the entity. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Invokes hook_entity_storage_load(). | |
ContentEntityStorageBase:: |
protected | function | Checks translation statuses and invoke the related hooks if needed. | |
ContentEntityStorageBase:: |
protected | function | Checks whether any entity revision is translated. | |
ContentEntityStorageBase:: |
protected | function | Checks whether any stored entity revision is translated. | |
ContentEntityStorageBase:: |
public | function |
Loads multiple entity revisions. Overrides RevisionableStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Load a specific entity revision. Overrides EntityStorageInterface:: |
1 |
ContentEntityStorageBase:: |
public | function |
Loads an unchanged entity from the database. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
public | function |
Reacts to the creation of a field. Overrides FieldDefinitionListenerInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Reacts to the update of a field. Overrides FieldDefinitionListenerInterface:: |
|
ContentEntityStorageBase:: |
protected | function | Populates the affected flag for all the revision translations. | |
ContentEntityStorageBase:: |
protected | function |
Gathers entities from a 'preload' step. Overrides EntityStorageBase:: |
|
ContentEntityStorageBase:: |
public | function |
Purges a batch of field data. Overrides FieldableEntityStorageInterface:: |
|
ContentEntityStorageBase:: |
public | function |
Resets the internal, static entity cache. Overrides EntityStorageBase:: |
1 |
ContentEntityStorageBase:: |
protected | function | Stores entities in the persistent cache backend. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
DeprecatedServicePropertyTrait:: |
public | function | Allows to access deprecated/removed properties. | |
EntityHandlerBase:: |
protected | property | The module handler to invoke hooks on. | 2 |
EntityHandlerBase:: |
protected | function | Gets the module handler. | 2 |
EntityHandlerBase:: |
public | function | Sets the module handler for this handler. | |
EntityStorageBase:: |
protected | property | Name of the entity class. | |
EntityStorageBase:: |
protected | property | Information about the entity type. | |
EntityStorageBase:: |
protected | property | Entity type ID for this storage. | |
EntityStorageBase:: |
protected | property | Name of the entity's ID field in the entity database table. | |
EntityStorageBase:: |
protected | property | The memory cache. | |
EntityStorageBase:: |
protected | property | The memory cache cache tag. | |
EntityStorageBase:: |
protected | property | Name of entity's UUID database table field, if it supports UUIDs. | 1 |
EntityStorageBase:: |
protected | property | The UUID service. | 1 |
EntityStorageBase:: |
protected | function | Builds the cache ID for the passed in entity ID. | 1 |
EntityStorageBase:: |
public | function |
Constructs a new entity object, without permanently saving it. Overrides EntityStorageInterface:: |
1 |
EntityStorageBase:: |
public | function |
Gets an aggregated query instance. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Gets the entity type definition. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Gets the entity type ID. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
protected | function | Gets entities from the static cache. | |
EntityStorageBase:: |
public | function |
Gets an entity query instance. Overrides EntityStorageInterface:: |
|
EntityStorageBase:: |
public | function |
Determines if the storage contains any data. Overrides EntityStorageInterface:: |
3 |
EntityStorageBase:: |
public | function |
Loads one entity. Overrides EntityStorageInterface:: |
2 |
EntityStorageBase:: |
public | function |
Load entities by their property values. Overrides EntityStorageInterface:: |
3 |
EntityStorageBase:: |
public | function |
Loads one or more entities. Overrides EntityStorageInterface:: |
1 |
EntityStorageBase:: |
protected | function | Attaches data to entities upon loading. | |
EntityStorageBase:: |
protected | function | Stores entities in the static entity cache. | |
EntityStorageInterface:: |
constant | Load the most recent version of an entity's field data. | ||
EntityStorageInterface:: |
constant | Load the version of an entity's field data specified in the entity. | ||
SqlContentEntityStorage:: |
protected | property | The base table of the entity. | |
SqlContentEntityStorage:: |
protected | property | Active database connection. | |
SqlContentEntityStorage:: |
protected | property | The table that stores properties, if the entity has multilingual support. | |
SqlContentEntityStorage:: |
protected | property | The default language entity key. | |
SqlContentEntityStorage:: |
protected | property | The entity type manager. | |
SqlContentEntityStorage:: |
protected | property | The entity type's field storage definitions. | |
SqlContentEntityStorage:: |
protected | property |
The entity langcode key. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | property | The language manager. | |
SqlContentEntityStorage:: |
protected | property | The table that stores revision field data if the entity supports revisions. | |
SqlContentEntityStorage:: |
protected | property | Name of entity's revision database table field, if it supports revisions. | |
SqlContentEntityStorage:: |
protected | property | The table that stores revisions, if the entity supports revisions. | |
SqlContentEntityStorage:: |
protected | property | The entity type's storage schema object. | |
SqlContentEntityStorage:: |
protected | property | The mapping of field columns to SQL tables. | |
SqlContentEntityStorage:: |
protected | property | Whether this storage should use the temporary table mapping. | |
SqlContentEntityStorage:: |
protected | function |
Builds an entity query. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Builds the query to load the entity. | |
SqlContentEntityStorage:: |
public | function |
Determines the number of entities with values for a given field. Overrides FieldableEntityStorageInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Deletes permanently saved entities. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Deletes values of fields in dedicated tables for all revisions. | |
SqlContentEntityStorage:: |
protected | function | Deletes values of fields in dedicated tables for all revisions. | |
SqlContentEntityStorage:: |
protected | function |
Deletes entity field values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Deletes field values of an entity revision from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Performs storage-specific loading of entities. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Actually loads revision field item values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Actually loads revision field item values from the storage. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Writes entity field values to the storage. Overrides ContentEntityStorageBase:: |
1 |
SqlContentEntityStorage:: |
public | function |
Performs final cleanup after all data of a field has been purged. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function | Gets the base table name. | |
SqlContentEntityStorage:: |
public | function | Gets a table mapping for the specified entity type and storage definitions. | |
SqlContentEntityStorage:: |
public | function | Gets the data table name. | |
SqlContentEntityStorage:: |
public | function | Gets the base field definitions for a content entity type. | |
SqlContentEntityStorage:: |
protected | function | Gets entities from the storage. | |
SqlContentEntityStorage:: |
protected | function |
Gets the name of the service for the query for this entity storage. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function | Gets the revision data table name. | |
SqlContentEntityStorage:: |
public | function | Gets the revision table name. | |
SqlContentEntityStorage:: |
protected | function | Gets the entity type's storage schema object. | |
SqlContentEntityStorage:: |
public | function |
Gets a table mapping for the entity's SQL tables. Overrides SqlEntityStorageInterface:: |
|
SqlContentEntityStorage:: |
protected | function |
Determines if this entity already exists in storage. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Initializes table name variables. | |
SqlContentEntityStorage:: |
protected | function | Checks whether a field column should be treated as serial. | 1 |
SqlContentEntityStorage:: |
protected | function | Loads values of fields stored in dedicated tables for a group of entities. | |
SqlContentEntityStorage:: |
protected | function | Loads values for fields stored in the shared data tables. | |
SqlContentEntityStorage:: |
protected | function |
Maps from storage records to entity objects, and attaches fields. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function | Maps from an entity object to the storage record of the field data. | |
SqlContentEntityStorage:: |
protected | function | Maps from an entity object to the storage record. | |
SqlContentEntityStorage:: |
public | function |
Reacts to a bundle being created. Overrides EntityBundleListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to a bundle being deleted. Overrides EntityBundleListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of the fieldable entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of a fieldable entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of a field. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the creation of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the deletion of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Reacts to the update of a field storage definition. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Removes field items from storage per entity during purge. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
protected | function |
Reads values to be purged for a single field. Overrides ContentEntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if the changes to the entity type requires storage schema changes. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Checks if the changes to the storage definition requires schema changes. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorage:: |
public | function |
Restores a previously saved entity. Overrides EntityStorageBase:: |
|
SqlContentEntityStorage:: |
public | function |
Saves the entity permanently. Overrides EntityStorageBase:: |
1 |
SqlContentEntityStorage:: |
protected | function | Saves an entity revision. | |
SqlContentEntityStorage:: |
protected | function | Saves values of fields that use dedicated tables. | 1 |
SqlContentEntityStorage:: |
protected | function | Saves fields that use the shared tables. | |
SqlContentEntityStorage:: |
public | function | Updates the wrapped entity type definition. | |
SqlContentEntityStorage:: |
public | function | Updates the internal list of field storage definitions. | |
SqlContentEntityStorage:: |
public | function | Sets the wrapped table mapping definition. | |
SqlContentEntityStorage:: |
public | function | Changes the temporary state of the storage. | |
SqlContentEntityStorage:: |
protected | function | Determines whether the passed field has been already deleted. | |
SqlContentEntityStorage:: |
protected | function | Wraps a database schema exception into an entity storage exception. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |