Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ModernMantra created an issue. See original summary.

ModernMantra’s picture

Referring to comment , providing possible fix for the problem.

JeroenT’s picture

Status: Active » Needs review
Berdir’s picture

Status: Needs review » Needs work

Please uncomment the corresponding @todo in the new test as well.

Berdir’s picture

Also I think this is actually the wrong issue for this change. We'll see that with the corresponding @todo.

ModernMantra’s picture

Status: Needs work » Needs review
FileSize
1.81 KB

Uncommented test and provided possible fix. Also discarding previous patch since it was not relevant as said.

Status: Needs review » Needs work

The last submitted patch, 6: support_deletions_translatable_fields-2834374-6.patch, failed testing.

Berdir’s picture

Obviously this is not correct. You can't just remove the existing logic.

ModernMantra’s picture

Status: Needs work » Needs review
FileSize
1.78 KB

Status: Needs review » Needs work

The last submitted patch, 9: support_deletions_translatable_fields-2834374-9.patch, failed testing.

miro_dietiker’s picture

I think the goal here is not clear. Before doing more implementations, please update the summary and clearly express the goal and wait for confirmation / discussion.

johnchque’s picture

Title: Support deletions for translatable fields » Support deletion of composite entities when parent is deleted
Issue summary: View changes

Updated IS.

johnchque’s picture

Status: Needs work » Needs review
FileSize
760 bytes

Is it me or this is already fixed?
Anyway, uncommenting tests. :)

Status: Needs review » Needs work

The last submitted patch, 13: support_deletion_of-2834374-13.patch, failed testing.

johnchque’s picture

Title: Support deletion of composite entities when parent is deleted » Support deletion of composite entities with parent field is translatable
Issue summary: View changes

OK, sorry, this is the right approach.

johnchque’s picture

Title: Support deletion of composite entities with parent field is translatable » Support deletion of composite entities when parent field is translatable

Sorry, typo.

Berdir’s picture

Note that we need to be *very* sure here that we are not deleting something that is still used, e.g. because a translation was copied.

We need to run a query and look for somehting else referencing this paragraph and if that is the case, not delete it. We also need test for that.

idebr’s picture

#17.1

Note that we need to be *very* sure here that we are not deleting something that is still used, e.g. because a translation was copied.

The translations of the composite entity are being deleted in #2834314: Support deleting translations of a composite reference . This leaves only the use case where the host entity is being deleted entirely. Unfortunately, there is currently no way to determine if the fieldItem is being deleted because an entity delete or a translation delete. This creates a dependency on a core patch: #2834384: Inconsistency: in FieldItem::delete we do not know if we are deleting the parent or only removing a translation. I suggest we postpone this issue until the Core issue is resolved.

#17.2

We need to run a query and look for somehting else referencing this paragraph and if that is the case, not delete it. We also need test for that.

This was determined by miro_dietiker to be out of scope in #2852522-8: Deletion of referenced entities on host delete, without checking usage/another reference, since composite entities are assumed to be part of a single parent entity. Did I interpret this correctly or should be incorporate the query from the related issue?

Status: Needs review » Needs work

The last submitted patch, 18: support_deletion_of-2834374-18.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

miro_dietiker’s picture

#17.2 "Something else" would be a previous revision of the parent owning host. I think that other kinds of ER references or even non-composite ERR wouldn't be relevant to determine if delete should be performed. Otherwise core would need to adopt entity usage tracking for delete validation as well...

Note though that the parent entity (not only the field) could vary across revisions.

idebr’s picture

#20 There is test coverage for maintaining composite entities for earlier revisions of the host entity in EntityReferenceRevisionsCompositeTest::testEntityReferenceRevisionsCompositeRelationship

Would you like to add coverage for changing the parent field / entity for composite entities in this issue? To me it feels a bit of out scope since a composite entity would be something like Paragraphs that are specifically tied to a host entity's field. It was not mentioned in earlier issues either, specially #2834314: Support deleting translations of a composite reference and #2834034: Deleting a translation deletes composite references on translatable fields

mbovan’s picture

Title: Support deletion of composite entities when parent field is translatable » [PP-1] Support deletion of composite entities when parent field is translatable
Status: Needs work » Needs review
Parent issue: » #2771531: [META] Remove obsolete composite entities from existing storage (garbage collection)
Related issues: +#3016388: Manual cleanup process for obsolete composite entities
FileSize
37.4 KB
1.41 KB
2.75 KB

This patch follows the same approach as #2953650: Composite entities are not removed on host delete if reference was removed in prior revision by relying on APIs that are going to be available with #3016388: Manual cleanup process for obsolete composite entities.

Thus, it is a different approach compared to #18.

The last submitted patch, 22: 2834374-22-3016388-60-COMBINED.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mbovan’s picture

Title: [PP-1] Support deletion of composite entities when parent field is translatable » [PP-2] Support deletion of composite entities when parent field is translatable
Related issues: +#2953650: Composite entities are not removed on host delete if reference was removed in prior revision

#2953650: Composite entities are not removed on host delete if reference was removed in prior revision adds $cron variable in the tests and that is the reason for test fails in #22.

mbovan’s picture

Title: [PP-2] Support deletion of composite entities when parent field is translatable » [PP-1] Support deletion of composite entities when parent field is translatable
Berdir’s picture

Title: [PP-1] Support deletion of composite entities when parent field is translatable » Support deletion of composite entities when parent field is translatable
Status: Needs review » Needs work
+++ b/tests/src/Kernel/EntityReferenceRevisionsCompositeTest.php
@@ -271,19 +271,19 @@ class EntityReferenceRevisionsCompositeTest extends EntityKernelTestBase {
 
-    // Test that the composite entity is not when the german translation of the parent is deleted.
+    // Test that the composite entity is not when delete the german translation
+    // of the parent is deleted.
     $node->removeTranslation('de');
     $node->save();
-    //$this->entityTypeManager->getStorage('entity_test_composite')->resetCache();

we seem to be missing a word in the comment, lets fix that as we touch it anyway.

mbovan’s picture

Berdir’s picture

Status: Needs review » Fixed

Committed, thanks.

  • Berdir committed 8e1c4d5 on 8.x-1.x authored by mbovan
    Issue #2834374 by mbovan, ModernMantra, idebr, yongt9412: Support...

Status: Fixed » Closed (fixed)

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