diff --git a/core/core.api.php b/core/core.api.php index 34e699b36bd8c055e32784b01a533d7b26c89ae5..5bd73fda95010dc75056305846bc94ca9dd245fd 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -559,8 +559,8 @@ * the ability to override any of the default behavior if needed. * See \Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags(), * \Drupal\Core\Entity\EntityTypeInterface::getListCacheTags(), - * \Drupal\Core\Entity\Entity::invalidateTagsOnSave() and - * \Drupal\Core\Entity\Entity::invalidateTagsOnDelete(). + * \Drupal\Core\Entity\EntityBase::invalidateTagsOnSave() and + * \Drupal\Core\Entity\EntityBase::invalidateTagsOnDelete(). * * @section context Cache contexts * diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 0c91c17127f562a87e46bed19fa2bc5efcf5de38..702e1744dbe073362b9dd56138690635aafeb48d 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -140,7 +140,7 @@ public function setOriginalId($id) { } /** - * Overrides Entity::isNew(). + * Overrides EntityBase::isNew(). * * EntityInterface::enforceIsNew() is only supported for newly created * configuration entities but has no effect after saving, since each diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php index 0e21b7f6d49a106c125ee5b1fe50d093441be03e..1e19838ff6f27fecfe3445f6c7757e36dfee97b8 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php @@ -34,9 +34,6 @@ abstract class EntityDisplayModeBase extends ConfigEntityBase implements EntityD /** * The entity type this form or view mode is used for. * - * This is not to be confused with EntityDisplayModeBase::$entityType which is - * inherited from Entity::$entityType. - * * @var string */ protected $targetEntityType; diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index abe043273d3f7282988e0488d683099c47f021d0..7b04a6a5eaa4713ebbd63292ae88249f58c871d9 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -424,7 +424,7 @@ public function getPermissionGranularity(); * placeholder of {node_type} used on the Node class. * * Specific entity types may also expand upon this list by overriding the - * Entity::urlRouteParameters() method. + * EntityBase::urlRouteParameters() method. * * @link http://www.iana.org/assignments/link-relations/link-relations.xml @endlink * @link http://tools.ietf.org/html/rfc6570 @endlink diff --git a/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php index 0d05bc967322b5ddccf1ee30537ee0b21cc82dae..8cc7fcce0e7d5b585f8bb0c0a1878bc6c034e4ce 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php @@ -39,8 +39,8 @@ public function getEntityTypeLabels($group = FALSE); * @throws \Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException * Thrown when no entity class corresponds to the called class. * - * @see \Drupal\Core\Entity\Entity::load() - * @see \Drupal\Core\Entity\Entity::loadMultiple() + * @see \Drupal\Core\Entity\EntityBase::load() + * @see \Drupal\Core\Entity\EntityBase::loadMultiple() */ public function getEntityTypeFromClass($class_name); diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 4af6932e45f4dce82a293a3238796b1522a576b5..09853d9adcac76f69a32f5c5c93610e090106836 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -136,7 +136,9 @@ * $entity->save(); * @endcode * There is also a shortcut method on entity classes, which creates an entity - * with an array of provided property values: \Drupal\Core\Entity::create(). + * with an array of provided property values. It is the create method. To create + * an Action entity one would use Drupal\system\Entity\Action::create(). For a + * custom entity use $yourEntityTypeClass::create(). * * Hooks invoked during the create operation: * - hook_ENTITY_TYPE_create() diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php index 3090314a597140b82246cba6de9ee2c9ff94e0aa..ef033cd466579a32554e71a796828d9561fd13d0 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php @@ -69,10 +69,11 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $uri = $entity->toUrl(); } catch (UndefinedLinkTemplateException) { - // This exception is thrown by \Drupal\Core\Entity\Entity::urlInfo() - // and it means that the entity type doesn't have a link template nor - // a valid "uri_callback", so don't bother trying to output a link for - // the rest of the referenced entities. + // This exception is thrown by + // \Drupal\Core\Entity\EntityInterface::toUrl() and it means that the + // entity type doesn't have a link template nor a valid + // "uri_callback", so don't bother trying to output a link for the + // rest of the referenced entities. $output_as_link = FALSE; } } diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php index ca9ac2ddd7e6ab0ad81ac03bd929a64911164422..32f5c20d6ec17125d17db54253319092142644e2 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php @@ -177,7 +177,7 @@ protected function viewValue(FieldItemInterface $item) { protected function getEntityUrl(EntityInterface $entity) { // For the default revision, the 'revision' link template falls back to // 'canonical'. - // @see \Drupal\Core\Entity\Entity::toUrl() + // @see \Drupal\Core\Entity\EntityBase::toUrl() $rel = $entity->getEntityType()->hasLinkTemplate('revision') ? 'revision' : 'canonical'; return $entity->toUrl($rel); } diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php index bbec5849b9998f9e47f5e620b9ef754615cdeedf..3bc7da26afcf251d38d13adbe5c14b24a35e1c20 100644 --- a/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -248,8 +248,8 @@ public function calculateDependencies() { public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); - // Entity::postSave() calls Entity::invalidateTagsOnSave(), which only - // handles the regular cases. The Block entity has one special case: a + // EntityBase::postSave() calls EntityBase::invalidateTagsOnSave(), which + // only handles the regular cases. The Block entity has one special case: a // newly created block may *also* appear on any page in the current theme, // so we must invalidate the associated block's cache tag (which includes // the theme cache tag). diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index 5bb7189cad623e475ea660e6836655c5744d5a7d..09db516b174a78da8bd1812714b133923f2119fb 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -153,7 +153,7 @@ public function postCreate(EntityStorageInterface $storage) { } /** - * Overrides \Drupal\Core\Entity\Entity::preSave(). + * Overrides \Drupal\Core\Entity\EntityBase::preSave(). * * @throws \Drupal\Core\Field\FieldException * If the field definition is invalid. diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index e5d68f9fced93d2fae1d96f60bdf1f983c8fe719..c399cd5392ae5fb316c340e2abff940d2d8658d1 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -307,7 +307,7 @@ public function postCreate(EntityStorageInterface $storage) { } /** - * Overrides \Drupal\Core\Entity\Entity::preSave(). + * Overrides \Drupal\Core\Entity\EntityBase::preSave(). * * @throws \Drupal\Core\Field\FieldException * If the field definition is invalid. diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php index 640b19ae3d506950fd81f0e5046ad425d1adcfdc..9f554f110288929dd94e4ecf7cc1cec6d6a39b36 100644 --- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php @@ -393,9 +393,7 @@ public function testLabelFormatter(): void { $this->assertEquals($this->referencedEntity->label(), $build[0]['#plain_text'], sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter)); $this->assertEquals($this->unsavedReferencedEntity->label(), $build[1]['#plain_text'], sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter)); - // Test an entity type that doesn't have any link templates, which means - // \Drupal\Core\Entity\EntityInterface::urlInfo() will throw an exception - // and the label formatter will output only the label instead of a link. + // Test an entity type that doesn't have any link templates. $field_storage_config = FieldStorageConfig::loadByName($this->entityType, $this->fieldName); $field_storage_config->setSetting('target_type', 'entity_test_label'); $field_storage_config->save(); diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php index 740505df96999954c768a926315600e742d62aa0..27e33681d1945426c2cbd680d888be8d4381941d 100644 --- a/core/modules/file/tests/src/Functional/FileListingTest.php +++ b/core/modules/file/tests/src/Functional/FileListingTest.php @@ -250,8 +250,7 @@ public function testFileListingUsageNoLink(): void { $this->drupalGet('admin/content/files/usage/' . $file->id()); $this->assertSession()->statusCodeEquals(200); - // Entity name should be displayed, but not linked if Entity::toUrl - // throws an exception + // Entity name should be displayed. $this->assertSession()->pageTextContains($entity_name); $this->assertSession()->linkNotExists($entity_name, 'Linked entity name not added to file usage listing.'); $this->assertSession()->linkExists($node->getTitle()); diff --git a/core/modules/node/tests/src/Kernel/NodeOwnerTest.php b/core/modules/node/tests/src/Kernel/NodeOwnerTest.php index 9bf8f9d2c96303de14993c17b105db860757bb30..a00bfbfd9203eb63d32d1bfaf2f2ce24d33c6689 100644 --- a/core/modules/node/tests/src/Kernel/NodeOwnerTest.php +++ b/core/modules/node/tests/src/Kernel/NodeOwnerTest.php @@ -73,7 +73,7 @@ public function testOwner(): void { $german->set('uid', ['target_id' => NULL]); $italian->set('uid', ['target_id' => NULL]); - // Entity::save() saves all translations! + // This saves all translations! $italian->save(); $this->assertEquals(0, $english->getOwnerId()); diff --git a/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php b/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php index 02a4a14e3d6b56f675b963099bdd14d721bc7186..91c6db7d396819ff6dd4f3d6924954795eda962d 100644 --- a/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php +++ b/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php @@ -54,7 +54,7 @@ public function onDynamicRouteEvent(RouteBuildEvent $event) { // Create a route for the 'create' link relation type for this entity // type that uses the same route definition as the REST 'POST' route // which use that entity type. - // @see \Drupal\Core\Entity\Entity::toUrl() + // @see \Drupal\Core\Entity\EntityBase::toUrl() $entity_create_route_name = "entity.$entity_type_id.create"; $route_collection->add($entity_create_route_name, $rest_post_route); } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 9ef8b61a4536a0b6b2b3ac4e83e5ad476442f8dd..b7c3cc936f7a7ba4a9ca028f4bf8f139c76593e2 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -1235,7 +1235,8 @@ protected function getEntityResourceUrl() { $has_canonical_url = $this->entity->hasLinkTemplate('canonical'); // Note that the 'canonical' link relation type must be specified explicitly // in the call to ::toUrl(). 'canonical' is the default for - // \Drupal\Core\Entity\Entity::toUrl(), but ConfigEntityBase overrides this. + // \Drupal\Core\Entity\EntityBase::toUrl(), but ConfigEntityBase overrides + // this. return $has_canonical_url ? $this->entity->toUrl('canonical') : Url::fromUri('base:entity/' . static::$entityTypeId . '/' . $this->entity->id()); } diff --git a/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php b/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php index fd90df500096b04d011f438ce3aa13b5103e6027..159324ec16321ed87d0a9aea57d7dacd31207647 100644 --- a/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php +++ b/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php @@ -201,7 +201,8 @@ protected function getEntityTypeManager() { * The context passed into the Normalizer. * * @return mixed - * The value to use in Entity::setValue(). + * The value to use in \Drupal\Core\Field\FieldItemBase::setValue() or a + * subclass. */ protected function constructValue($data, $context) { $field_item = $context['target_instance']; diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index 5398c561cf5566660d2ca675eb574f9a9929f7f4..3d591b3ada3e86e5b95919319dd54e1c3e676d59 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -99,9 +99,9 @@ public function getUrl() { public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); - // Entity::postSave() calls Entity::invalidateTagsOnSave(), which only - // handles the regular cases. The Shortcut entity has one special case: a - // newly created shortcut is *also* added to a shortcut set, so we must + // EntityBase::postSave() calls EntityBase::invalidateTagsOnSave(), which + // only handles the regular cases. The Shortcut entity has one special case: + // a newly created shortcut is *also* added to a shortcut set, so we must // invalidate the associated shortcut set's cache tag. if (!$update) { Cache::invalidateTags($this->getCacheTagsToInvalidate()); diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 0550fb213eb6d18d4837295f8e9c2e446d835c6c..67e30a95cf442f40150fb417612ee1eb90bff91c 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -426,7 +426,7 @@ protected function addEntityLinks(array &$data) { * @param string $field_name * The name of the field to handle. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition - * The field definition defined in Entity::baseFieldDefinitions() + * The field definition. * @param \Drupal\Core\Entity\Sql\TableMappingInterface $table_mapping * The table mapping information * @param array $table_data diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php index 6e59c42708875698710bf0947561a51898bb99ce..4299d1a413862696612ffb3861849ef692c51db3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php @@ -56,7 +56,7 @@ protected function setUp(): void { } /** - * Tests for the Entity::toLink() method. + * Tests for the EntityBase::toLink() method. * * @covers ::toLink * diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index 43816924d15139f23d3b38135376c729391e875c..858efd23227592ddb912ba3837e5423ec880ff04 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -233,7 +233,7 @@ public function testLanguage(): void { */ public function setupTestLoad() { // Base our mocked entity on a real entity class so we can test if calling - // Entity::load() on the base class will bubble up to an actual entity. + // EntityBase::load() on the base class will bubble up to an actual entity. $this->entityTypeId = 'entity_test_mul'; $methods = get_class_methods(EntityTestMul::class); unset($methods[array_search('load', $methods)]); @@ -247,7 +247,7 @@ public function setupTestLoad() { } /** - * Tests Entity::load(). + * Tests EntityBase::load(). * * When called statically on a subclass of Entity. * @@ -277,12 +277,13 @@ public function testLoad(): void { \Drupal::getContainer()->set('entity_type.repository', $entity_type_repository); - // Call Entity::load statically and check that it returns the mock entity. + // Call EntityBase::load statically and check that it returns the mock + // entity. $this->assertSame($this->entity, $class_name::load(1)); } /** - * Tests Entity::loadMultiple(). + * Tests EntityBase::loadMultiple(). * * When called statically on a subclass of Entity. * @@ -312,8 +313,8 @@ public function testLoadMultiple(): void { \Drupal::getContainer()->set('entity_type.repository', $entity_type_repository); - // Call Entity::loadMultiple statically and check that it returns the mock - // entity. + // Call EntityBase::loadMultiple() statically and check that it returns the + // mock entity. $this->assertSame([1 => $this->entity], $class_name::loadMultiple([1])); } @@ -344,7 +345,7 @@ public function testCreate(): void { \Drupal::getContainer()->set('entity_type.repository', $entity_type_repository); - // Call Entity::create() statically and check that it returns the mock + // Call EntityBase::create() statically and check that it returns the mock // entity. $this->assertSame($this->entity, $class_name::create([])); }