Skip to content
Snippets Groups Projects
Commit ca69fcf1 authored by Aaron Bauman's avatar Aaron Bauman
Browse files

Missed the new file

parent 735ea650
No related branches found
No related tags found
No related merge requests found
<?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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment