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.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | fieldable_path-entity-interface-check-2879375-12.patch | 1 KB | spleshka |
| #9 | check_has_field_entity_method.patch | 475 bytes | huyby |
Comments
Comment #2
huyby commentedComment #3
spleshkaGood point, thanks for the report. I'll review the issue and get back to you soon.
Comment #4
spleshkaSetting the issue status to the right one.
Comment #5
huyby commentedComment #6
spleshkaJust FYI: the issue status should be changed to "Needs review" once you provide a patch in order to run automated tests against it.
Comment #7
spleshkaI think you'll find this documentation helpful as well: https://www.drupal.org/node/707484
Comment #9
huyby commentedCorrected patch, also available at https://gist.github.com/huyby/2c9a23c14a310580f7d9098875bfacdc
Comment #10
spleshkaI think it makes sense to check if the entity implements the right interface which contains
hasFieldmethod instead of just checking the method existance. What do you think?Comment #11
huyby commentedThat's indeed a better approach, the interface would be
Drupal\Core\Entity\FieldableEntityInterface.Comment #12
spleshkaDoes this patch makes sense / work for you?
Comment #14
spleshkaCommitted the patch with minor adjustment. Thanks @huyby for your contribution!