The method FieldablePathController::checkEntityAndSyncPath should check if the entity, that's being synced, has a 'hasField' method. Currently this ends up in an 'Call to undefined method'.

I found out about the bug when trying to install the Webform module and importing configuration:

Call to undefined method Drupal\webform\Entity\Webform::hasField() in .... modules/contrib/fieldable_path/src/Controller/FieldablePathController.php on line 46

A patch is submitted with this post to fix the issue.

Comments

huyby created an issue. See original summary.

huyby’s picture

spleshka’s picture

Good point, thanks for the report. I'll review the issue and get back to you soon.

spleshka’s picture

Status: Patch (to be ported) » Needs work

Setting the issue status to the right one.

huyby’s picture

StatusFileSize
new536 bytes
spleshka’s picture

Status: Needs work » Needs review

Just FYI: the issue status should be changed to "Needs review" once you provide a patch in order to run automated tests against it.

spleshka’s picture

I think you'll find this documentation helpful as well: https://www.drupal.org/node/707484

Status: Needs review » Needs work

The last submitted patch, 5: check_has_field_entity_method.patch, failed testing.

huyby’s picture

StatusFileSize
new475 bytes
spleshka’s picture

I think it makes sense to check if the entity implements the right interface which contains hasField method instead of just checking the method existance. What do you think?

huyby’s picture

That's indeed a better approach, the interface would be Drupal\Core\Entity\FieldableEntityInterface.

spleshka’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB

Does this patch makes sense / work for you?

  • Spleshka committed 0e0c795 on 8.x-1.x authored by huyby
    Issue #2879375 by huyby, Spleshka: checkEntityAndSyncPath causes error...
spleshka’s picture

Version: 8.x-1.0-rc3 » 8.x-1.x-dev
Status: Needs review » Fixed

Committed the patch with minor adjustment. Thanks @huyby for your contribution!

Status: Fixed » Closed (fixed)

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