Error on deleting parent node

Created on 8 March 2024, 4 months ago
Updated 5 April 2024, 3 months ago

Problem/Motivation

Attempting to delete a node that has a content type that is used as parent for another child content type produces an error:
InvalidArgumentException: Field field_business_menu is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of .../web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Steps to reproduce

Using Drupal version 10.2.4, PHP 8.3.3, Entity Hierarchy v 5.0.0-alpha3
1. Create a parent content type.
2. Create a child content type.
3. In the child content type, add a field of type "Entity reference hierarchy" that references the parent content type.
4. Create a node of the parent content type.
5. Attempt to delete the node created in the previous step.

πŸ› Bug report
Status

Closed: duplicate

Version

5.0

Component

Code (module)

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tsjobom
  • Status changed to Postponed: needs info 4 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    IS this the same issue as πŸ› Entity hierarchy checks field exists on entity but not bundle Active ?

  • Maybe related? The stack trace is different though. Here's my stack trace if it helps:

    #0 /home/find/public_html/eyn/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(597): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('field_business_...', 'x-default')
    #1 /home/find/public_html/eyn/web/modules/contrib/entity_hierarchy/src/Storage/QueryBuilder.php(102): Drupal\Core\Entity\ContentEntityBase->get('field_business_...')
    #2 /home/find/public_html/eyn/web/modules/contrib/entity_hierarchy/src/Information/ChildEntityWarningBuilder.php(62): Drupal\entity_hierarchy\Storage\QueryBuilder->findParent(Object(Drupal\node\Entity\Node))
    #3 /home/find/public_html/eyn/web/modules/contrib/entity_hierarchy/entity_hierarchy.module(83): Drupal\entity_hierarchy\Information\ChildEntityWarningBuilder->buildChildEntityWarnings(Object(Drupal\node\Entity\Node))
    #4 /home/find/public_html/eyn/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(545): entity_hierarchy_form_alter(Array, Object(Drupal\Core\Form\FormState), 'node_business_m...')

  • Status changed to Closed: duplicate 3 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Yep, the stack trace in the other issue is from a test fail, but the MR fixes the code-path you've mentioned.

    Would be good to get a test for the other issue and get it in.

Production build 0.69.0 2024