Problem/Motivation

Config (entities) can depend on modules, themes as well as entities. For some time, it could not depend on content entities, only config entities, so they $type 'entity' was used. Since content entities was also supported, 'entity' was changed to 'content' and 'config' to distinguish the cases. But still, the method documentation of DependencyTrait::addDependency() mentions only 'entity'.

Proposed resolution

Change 'entity' to 'config' and 'content' there.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gaurav_varshney’s picture

Status: Active » Needs review
FileSize
821 bytes
eojthebrave’s picture

Status: Needs review » Needs work

Thanks for the patch.

+++ b/core/lib/Drupal/Core/Entity/DependencyTrait.php
@@ -23,10 +23,10 @@
+   *   The type of dependency being added: 'module', 'theme', or 'config' and 'content'.

This line should wrap at 80 characters per the code standards.

I also find the wording a little off, maybe just ... "theme, config, or content" and remove the "and"?

+++ b/core/lib/Drupal/Core/Entity/DependencyTrait.php
@@ -23,10 +23,10 @@
+   *   $type is 'config' and 'content', the full configuration object name.

I think this should be "config or content" not "config and content". And, should this be something like "the full content object" or similar if this is of the type 'content'?

mmatsoo’s picture

Assigned: Unassigned » mmatsoo
mmatsoo’s picture

Assigned: mmatsoo » Unassigned
Status: Needs work » Needs review
FileSize
862 bytes

Changed and shortened text.

Status: Needs review » Needs work

The last submitted patch, 4: dependencytrait-documentation-2485403-4.patch, failed testing.

mmatsoo’s picture

Status: Needs work » Needs review
FileSize
838 bytes

Trying again. Not sure why last patch failed testing.

Status: Needs review » Needs work

The last submitted patch, 6: dependencytrait-documentation-2485403-5.patch, failed testing.

mmatsoo’s picture

Status: Needs work » Needs review
FileSize
887 bytes

One more time. After this I can't imagine why the patch keeps failing.

iMiksu’s picture

Status: Needs review » Reviewed & tested by the community

Docs and patch looking good.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Entity/DependencyTrait.php
@@ -23,10 +23,10 @@
+   *   If $type is 'config' or 'content', the full configuration object name.

Should be the result of getConfigDependencyName(). For configuration entities this is the configuration object name - but for content entities this is entity_type:bundle:UUID. Also this line should wrap with the previous line.

mmatsoo’s picture

Assigned: Unassigned » mmatsoo
mmatsoo’s picture

Assigned: mmatsoo » Unassigned
Status: Needs work » Needs review
FileSize
883 bytes

Updated text and got rid of unnecessary line feed.

alexpott’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Entity/DependencyTrait.php
@@ -23,10 +23,11 @@
+   *   $type is 'config', the full configuration object name. If $type is ¶
+   *   'content', then the string is formatted entity_type:bundle:UUID.
...
    * @see \Drupal\Core\Entity\EntityInterface::getConfigDependencyName()

I think we should just say that this is the result of EntityInterface::getConfigDependencyName() since what that actually returns is an implementation detail.

mmatsoo’s picture

Assigned: Unassigned » mmatsoo
mmatsoo’s picture

Assigned: mmatsoo » Unassigned
Status: Needs work » Needs review
FileSize
840 bytes

Switched text to be closer to original where config and content types are documented in the same sentence, now as the result of EntityInterface::getConfigDependencyName().

eojthebrave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. Current patch addresses all the concerns so far and the comments are correctly formatted. So I think this is RTBC.

FWIW. I haven't actually applied this locally, but it's just a documentation change, and the test bot says that it is able to apply the patch so I think this is safe.

  • alexpott committed 34a5bd1 on 8.0.x
    Issue #2485403 by mmatsoo, gaurav_varshney: DependencyTrait...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 34a5bd1 and pushed to 8.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.