diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index ab68c4a..23e6a16 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Entity; +use Drupal\Core\Entity\Plugin\DataType\EntityReference; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TypedDataInterface; @@ -919,4 +920,25 @@ public function label($langcode = NULL) { return $label; } + /** + * {@inheritdoc} + */ + public function referencedEntities() { + $referenced_entities = array(); + + // Gather a list of referenced entities. + foreach ($this->getProperties() as $field_items) { + foreach ($field_items as $field_item) { + // Loop over all properties of a field item. + foreach ($field_item->getProperties(TRUE) as $property) { + if ($property instanceof EntityReference && $entity = $property->getTarget()) { + $referenced_entities[] = $entity; + } + } + } + } + + return $referenced_entities; + } + } diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 19e5952..4a5c6cd 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -347,24 +347,7 @@ public static function postLoad(EntityStorageControllerInterface $storage_contro * {@inheritdoc} */ public function referencedEntities() { - $referenced_entities = array(); - - // @todo Remove when all entities are converted to EntityNG. - if (!$this->getPropertyDefinitions()) { - return $referenced_entities; - } - - // Gather a list of referenced entities. - foreach ($this->getProperties() as $name => $definition) { - $field_items = $this->get($name); - foreach ($field_items as $offset => $field_item) { - if ($field_item instanceof EntityReferenceItem && $entity = $field_item->entity) { - $referenced_entities[] = $entity; - } - } - } - - return $referenced_entities; + return array(); } /** diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php index 23fec2e..55c95cd 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php @@ -135,7 +135,7 @@ class Feed extends ContentEntityBase implements FeedInterface { public $modified; /** - * Overrides Drupal\Core\Entity\EntityNG::init(). + * {@inheritdoc} */ public function init() { parent::init(); diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php index 74d6082..184e811 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php @@ -137,8 +137,7 @@ public function testCreate() { $this->assertResponse(404); $this->assertFalse(entity_load_multiple($entity_type, NULL, TRUE), 'No entity has been created in the database.'); - // @todo Once EntityNG is implemented for other entity types add a security - // test. It should not be possible for example to create a test entity on a - // node resource route. + // @todo Add a security test. It should not be possible for example to + // create a test entity on a node resource route. } } diff --git a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php index 7c84cfd..a22174e 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php @@ -34,8 +34,7 @@ public static function getInfo() { * Tests several valid and invalid read requests on all entity types. */ public function testRead() { - // @todo once EntityNG is implemented for other entity types expand this at - // least to users. + // @todo Expand this at least to users. // Define the entity types we want to test. $entity_types = array('entity_test', 'node'); foreach ($entity_types as $entity_type) { diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php index a30e615..11359b4 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php @@ -34,8 +34,7 @@ public static function getInfo() { */ public function testPatchUpdate() { $serializer = $this->container->get('serializer'); - // @todo once EntityNG is implemented for other entity types test all other - // entity types here as well. + // @todo Test all other entity types here as well. $entity_type = 'entity_test'; $this->enableService('entity:' . $entity_type, 'PATCH'); diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php index 9857c25..c5fd7f1 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php @@ -48,7 +48,7 @@ class EntityTestRev extends EntityTest { public $revision_id; /** - * Overrides EntityNG::init(). + * {@inheritdoc} */ public function init() { parent::init(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php index 6a1d191..7046912 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -130,7 +130,7 @@ public function id() { } /** - * Overides \Drupal\Core\Entity\EntityNG::init(). + * {@inheritdoc} */ protected function init() { parent::init();