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

Issue fork salesforce-3502753

Command icon 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:

Comments

balazswmann created an issue. See original summary.

balazswmann’s picture

I'm attaching a patch to resolve the issue for salesforce 5.1.1

aaronbauman’s picture

This 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?

prem suthar made their first commit to this issue’s fork.

balazswmann’s picture

@aaronbauman:

I see you're mapping a custom object, why not just implement the interface?

Because it's not my code. It's a contrib. We cannot tell contrib developers to please implement the SynchronizableInterface interface 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.

aaronbauman’s picture

Status: Active » Reviewed & tested by the community

Because it's not my code. It's a contrib

Well, 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.

aaronbauman changed the visibility of the branch 3502753-call-to-undefined to hidden.

  • aaronbauman committed b6a44585 on 5.0.x
    Issue #3502753 by balazswmann: Call to undefined method ::isSyncing()...

  • aaronbauman committed bd5f92d1 on 5.1.x
    Issue #3502753 by balazswmann: Call to undefined method ::isSyncing()...
aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

committed, thanks

balazswmann’s picture

@aaronbauman Thank you very much for the commit and in general for your thoughts about this problem.

Status: Fixed » Closed (fixed)

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