Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
salesforce-3257058
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
salesforce-3257058
Commits
9175dc05
Commit
9175dc05
authored
8 years ago
by
git
Browse files
Options
Downloads
Plain Diff
Merge branch '8.x-3.x' into mads-30
parents
3a054a2c
d084e717
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/salesforce_push/salesforce_push.module
+7
-13
7 additions, 13 deletions
modules/salesforce_push/salesforce_push.module
with
7 additions
and
13 deletions
modules/salesforce_push/salesforce_push.module
+
7
−
13
View file @
9175dc05
...
...
@@ -38,15 +38,6 @@ function salesforce_push_entity_delete(EntityInterface $entity) {
salesforce_push_entity_crud
(
$entity
,
MappingConstants
::
SALESFORCE_MAPPING_SYNC_DRUPAL_DELETE
);
}
function
salesforce_push_salesforce_push_entity_allowed
(
EntityInterface
$entity
,
SalesforceMappingInterface
$mapping
,
$op
)
{
// Don't allow mapped objects or mappings to be pushed!
// @TODO can we implement this instead with a validation constraint? This is fugly.
if
(
$entity
instanceof
MappedObjectInterface
||
$entity
instanceof
SalesforceMappingInterface
)
{
return
FALSE
;
}
}
/**
* Push entities to Salesforce.
*
...
...
@@ -62,6 +53,12 @@ function salesforce_push_salesforce_push_entity_allowed(EntityInterface $entity,
* to be a very long ways away. https://www.drupal.org/node/2551893
*/
function
salesforce_push_entity_crud
(
EntityInterface
$entity
,
$op
)
{
// Don't allow mapped objects or mappings to be pushed!
if
(
$entity
instanceof
MappedObjectInterface
||
$entity
instanceof
SalesforceMappingInterface
)
{
return
;
}
try
{
$mappings
=
salesforce_push_load_push_mappings
(
$entity
->
getEntityTypeId
());
}
...
...
@@ -91,15 +88,12 @@ function salesforce_push_entity_crud(EntityInterface $entity, $op) {
function
salesforce_push_entity_crud_mapping
(
EntityInterface
$entity
,
$op
,
SalesforceMappingInterface
$mapping
)
{
$mapped_objects
=
[];
$mapped_object
=
null
;
// Implementations of hook_salesforce_push_entity_allowed should throw an
// exception to prevent push.
\Drupal
::
moduleHandler
()
->
invokeAll
(
'salesforce_push_entity_allowed'
,
array
(
$entity
,
$mapping
,
$op
));
// Event subscribers should throw an exception to prevent push.
\Drupal
::
service
(
'event_dispatcher'
)
->
dispatch
(
SalesforceEvents
::
PUSH_ALLOWED
,
new
SalesforcePushEvent
(
$mapped_object
,
NULL
,
$op
)
);
// Look for existing mapped object or create a new one (except for deletes).
$props
=
[
'entity_id'
=>
$entity
->
id
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment