Issue #2926540 by amateescu, plach, xjm, hchonov, Berdir: Split revision-handling methods to a separate entity storage interface
parent
7fb8c07f2a
commit
06c7b727bc
|
@ -132,13 +132,6 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function loadMultipleRevisions(array $revision_ids) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace Drupal\Core\Entity;
|
||||||
/**
|
/**
|
||||||
* A storage that supports content entity types.
|
* A storage that supports content entity types.
|
||||||
*/
|
*/
|
||||||
interface ContentEntityStorageInterface extends EntityStorageInterface {
|
interface ContentEntityStorageInterface extends EntityStorageInterface, RevisionableStorageInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new entity translation object, without permanently saving it.
|
* Constructs a new entity translation object, without permanently saving it.
|
||||||
|
|
|
@ -79,21 +79,15 @@ interface EntityStorageInterface {
|
||||||
*
|
*
|
||||||
* @return \Drupal\Core\Entity\EntityInterface|null
|
* @return \Drupal\Core\Entity\EntityInterface|null
|
||||||
* The specified entity revision or NULL if not found.
|
* The specified entity revision or NULL if not found.
|
||||||
|
*
|
||||||
|
* @todo Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
|
||||||
|
* Use \Drupal\Core\Entity\RevisionableStorageInterface instead.
|
||||||
|
*
|
||||||
|
* @see https://www.drupal.org/node/2926958
|
||||||
|
* @see https://www.drupal.org/node/2927226
|
||||||
*/
|
*/
|
||||||
public function loadRevision($revision_id);
|
public function loadRevision($revision_id);
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads multiple entity revisions.
|
|
||||||
*
|
|
||||||
* @param array $revision_ids
|
|
||||||
* An array of revision IDs to load.
|
|
||||||
*
|
|
||||||
* @return \Drupal\Core\Entity\EntityInterface[]
|
|
||||||
* An array of entity revisions keyed by their revision ID, or an empty
|
|
||||||
* array if none found.
|
|
||||||
*/
|
|
||||||
public function loadMultipleRevisions(array $revision_ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a specific entity revision.
|
* Delete a specific entity revision.
|
||||||
*
|
*
|
||||||
|
@ -101,6 +95,12 @@ interface EntityStorageInterface {
|
||||||
*
|
*
|
||||||
* @param int $revision_id
|
* @param int $revision_id
|
||||||
* The revision id.
|
* The revision id.
|
||||||
|
*
|
||||||
|
* @todo Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
|
||||||
|
* Use \Drupal\Core\Entity\RevisionableStorageInterface instead.
|
||||||
|
*
|
||||||
|
* @see https://www.drupal.org/node/2926958
|
||||||
|
* @see https://www.drupal.org/node/2927226
|
||||||
*/
|
*/
|
||||||
public function deleteRevision($revision_id);
|
public function deleteRevision($revision_id);
|
||||||
|
|
||||||
|
|
|
@ -23,4 +23,11 @@ class KeyValueContentEntityStorage extends KeyValueEntityStorage implements Cont
|
||||||
*/
|
*/
|
||||||
public function createWithSampleValues($bundle = FALSE, array $values = []) {}
|
public function createWithSampleValues($bundle = FALSE, array $values = []) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function loadMultipleRevisions(array $revision_ids) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,13 +130,6 @@ class KeyValueEntityStorage extends EntityStorageBase {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function loadMultipleRevisions(array $revision_ids) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\Core\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A storage that supports revisionable entity types.
|
||||||
|
*/
|
||||||
|
interface RevisionableStorageInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a specific entity revision.
|
||||||
|
*
|
||||||
|
* @param int $revision_id
|
||||||
|
* The revision ID.
|
||||||
|
*
|
||||||
|
* @return \Drupal\Core\Entity\EntityInterface|null
|
||||||
|
* The specified entity revision or NULL if not found.
|
||||||
|
*/
|
||||||
|
public function loadRevision($revision_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads multiple entity revisions.
|
||||||
|
*
|
||||||
|
* @param array $revision_ids
|
||||||
|
* An array of revision IDs to load.
|
||||||
|
*
|
||||||
|
* @return \Drupal\Core\Entity\EntityInterface[]
|
||||||
|
* An array of entity revisions keyed by their revision ID, or an empty
|
||||||
|
* array if none found.
|
||||||
|
*/
|
||||||
|
public function loadMultipleRevisions(array $revision_ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a specific entity revision.
|
||||||
|
*
|
||||||
|
* A revision can only be deleted if it's not the currently active one.
|
||||||
|
*
|
||||||
|
* @param int $revision_id
|
||||||
|
* The revision ID.
|
||||||
|
*/
|
||||||
|
public function deleteRevision($revision_id);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue