diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php index 7e413b0..0fb2330 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Entity\Plugin\DataType; use Drupal\Component\Utility\String; -use Drupal\Core\Entity\ContentEntityInterface; +use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\TypedData\EntityDataDefinition; use Drupal\Core\TypedData\ComplexDataInterface; @@ -83,7 +83,7 @@ public function get($property_name) { if (!isset($this->entity)) { throw new MissingDataException(String::format('Unable to get property @name as no entity has been provided.', array('@name' => $property_name))); } - if (!$this->entity instanceof ContentEntityInterface) { + if (!$this->entity instanceof FieldableEntityInterface) { // @todo: Add support for config entities in // https://www.drupal.org/node/1818574. throw new \InvalidArgumentException(String::format('Unable to get unknown property @name.', array('@name' => $property_name))); @@ -99,7 +99,7 @@ public function set($property_name, $value, $notify = TRUE) { if (!isset($this->entity)) { throw new MissingDataException(String::format('Unable to set property @name as no entity has been provided.', array('@name' => $property_name))); } - if (!$this->entity instanceof ContentEntityInterface) { + if (!$this->entity instanceof FieldableEntityInterface) { // @todo: Add support for config entities in // https://www.drupal.org/node/1818574. throw new \InvalidArgumentException(String::format('Unable to set unknown property @name.', array('@name' => $property_name))); @@ -115,7 +115,7 @@ public function getProperties($include_computed = FALSE) { if (!isset($this->entity)) { throw new MissingDataException(String::format('Unable to get properties as no entity has been provided.')); } - if (!$this->entity instanceof ContentEntityInterface) { + if (!$this->entity instanceof FieldableEntityInterface) { // @todo: Add support for config entities in // https://www.drupal.org/node/1818574. return array(); @@ -144,7 +144,7 @@ public function isEmpty() { * {@inheritdoc} */ public function onChange($property_name) { - if (isset($this->entity) && $this->entity instanceof ContentEntityInterface) { + if (isset($this->entity) && $this->entity instanceof FieldableEntityInterface) { // Let the entity know of any changes. $this->entity->onChange($property_name); } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 35f28c4..05b6e8e 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -14,6 +14,7 @@ use Drupal\comment\Entity\Comment; use Drupal\comment\CommentManagerInterface; use Drupal\comment\Entity\CommentType; +use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityInterface; @@ -411,7 +412,7 @@ function comment_entity_predelete(EntityInterface $entity) { // mismatched types. So, we need to verify that the ID is numeric (even for an // entity type that has an integer ID, $entity->id() might be a string // containing a number), and then cast it to an integer when querying. - if ($entity instanceof ContentEntityInterface && is_numeric($entity->id())) { + if ($entity instanceof FieldableEntityInterface && is_numeric($entity->id())) { $entity_query = \Drupal::entityQuery('comment'); $entity_query->condition('entity_id', (int) $entity->id()); $entity_query->condition('entity_type', $entity->getEntityTypeId());