Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
salesforce
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
salesforce
Commits
ca69fcf1
Commit
ca69fcf1
authored
1 year ago
by
Aaron Bauman
Browse files
Options
Downloads
Patches
Plain Diff
Missed the new file
parent
735ea650
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_mapping/src/Event/SalesforcePullEnqueueEvent.php
+147
-0
147 additions, 0 deletions
...lesforce_mapping/src/Event/SalesforcePullEnqueueEvent.php
with
147 additions
and
0 deletions
modules/salesforce_mapping/src/Event/SalesforcePullEnqueueEvent.php
0 → 100644
+
147
−
0
View file @
ca69fcf1
<?php
namespace
Drupal\salesforce_mapping\Event
;
use
Drupal\salesforce\Event\SalesforceBaseEvent
;
use
Drupal\salesforce\SelectQueryResult
;
use
Drupal\salesforce\SFID
;
use
Drupal\salesforce\SObject
;
use
Drupal\salesforce_mapping
\Entity\SalesforceMappingInterface
;
/**
* Salesforce Pull Enqueue Event.
*/
class
SalesforcePullEnqueueEvent
extends
SalesforceBaseEvent
{
/**
* The mapping responsible for this pull.
*
* @var SalesforceMappingInterface
*/
protected
$mapping
;
/**
* The SelectQueryResult object associated with this pull.
*
* @var SelectQueryResult
*/
protected
$records
;
/**
* Current SObject from the loop.
*
* @var SObject
*/
protected
$record
;
/**
* Whether to force pull for the given record.
*
* @var bool
*/
protected
$forcePull
;
/**
* TRUE or FALSE to indicate if pull is allowed for this event.
*
* @var bool
*/
protected
$enqueueAllowed
;
/**
* @param SalesforceMappingInterface $mapping
* @param SelectQueryResult $records
* @param SObject $record
*/
public
function
__construct
(
SalesforceMappingInterface
$mapping
,
SelectQueryResult
$records
,
SObject
$record
,
$force_pull
){
$this
->
mapping
=
$mapping
;
$this
->
records
=
$records
;
$this
->
record
=
$record
;
$this
->
forcePull
=
$force_pull
;
$this
->
enqueueAllowed
=
TRUE
;
}
/**
* Get Mapping Interface object
*
* @return SalesforceMappingInterface;
*
*/
public
function
getMapping
()
{
return
$this
->
mapping
;
}
/**
* Get all records.
*
* @return SelectQueryResult;
*
*/
public
function
getRecords
()
{
return
$this
->
records
;
}
/**
* Returns SF Object Type.
* @return string
*/
public
function
getRecordType
()
{
return
$this
->
record
->
type
();
}
/**
* @return SFID
*/
public
function
getRecordId
(){
return
$this
->
record
->
id
();
}
/**
* @return SObject
*/
public
function
getRecord
()
{
return
$this
->
record
;
}
/**
* @return array
*/
public
function
getCurrentRecordFields
()
{
return
$this
->
record
->
fields
();
}
/**
* Disallow queue item.
*/
public
function
disallowEnqueue
()
{
$this
->
enqueueAllowed
=
FALSE
;
return
$this
;
}
/**
* Will return FALSE if any subscribers have called disallowPull().
*
* @return bool
* TRUE if pull is allowed, false otherwise.
*/
public
function
isEnqueueAllowed
()
{
return
$this
->
enqueueAllowed
;
}
/**
* Getter.
*
* @return bool
* Force pull.
*/
public
function
getForcePull
()
{
// Legacy backwards compatibility.
// @TODO remove for 8.x-3.3
if
(
property_exists
(
$this
,
'force_pull'
))
{
return
$this
->
force_pull
;
}
return
$this
->
forcePull
;
}
}
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