Problem/Motivation
I'm using the Apigee module which has Developer entities and when I create a new user account I get the following error:
Error: Call to undefined method Drupal\apigee_edge\Entity\Developer::isSyncing() in salesforce_push_entity_crud() (line 50 of /mnt/files/local_mount/build/web/modules/contrib/salesforce/modules/salesforce_push/salesforce_push.module).
The underlying problem is that salesforce_push_entity_crud() does not check whether the entity implements Drupal\Core\Entity\SynchronizableInterface before calling the ::isSyncing() method on it.
Steps to reproduce
Try to create an entity which does not implement the SynchronizableInterface.
Proposed resolution
Make sure that salesforce_push_entity_crud() only calls ::isSyncing() on entities which implement the Drupal\Core\Entity\SynchronizableInterface interface.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | salesforce-call-to-undefined-method-issyncing-3502753-2.patch | 1.11 KB | balazswmann |
Issue fork salesforce-3502753
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3502753-call-to-undefined
changes, plain diff MR !91
Comments
Comment #2
balazswmann commentedI'm attaching a patch to resolve the issue for salesforce 5.1.1
Comment #3
aaronbaumanThis is fine for now, but imo we should enforce implementation of SynchronizableInterface in order for entities to be mappable.
I see you're mapping a custom object, why not just implement the interface?
Comment #6
balazswmann commented@aaronbauman:
Because it's not my code. It's a contrib. We cannot tell contrib developers to please implement the
SynchronizableInterfaceinterface for all custom entities to make sure that the Salesforce Suite module does not break :) It's the Salesforce module's responsibility to make sure that the methods and functions it's using (either from core or from other contribs) are available and callable.Comment #7
aaronbaumanWell, yes, i guess that would do it.
I can't think of a reason why an entity would not be either config or content, but I guess they've found one.
You're right, there's no reason we should prevent this kind of entity from being mapped.
However, a word of caution: in terms of the motivation for isSyncing() - this check is designed to prevent push-pull feedback loops between Drupal and Salesforce. I'm not inclined to implement a workaround inside the module for this edge case, but something you'll want to watch out for.
Comment #11
aaronbaumancommitted, thanks
Comment #12
balazswmann commented@aaronbauman Thank you very much for the commit and in general for your thoughts about this problem.