-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from PowerSync/develop
Develop
- Loading branch information
Showing
18 changed files
with
1,290 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace TNW\Salesforce\Synchronize\Transport\Calls\Delete; | ||
|
||
/** | ||
* Unit interface | ||
*/ | ||
interface InputInterface | ||
{ | ||
/** | ||
* Do Unit syncronization to Salesforce object | ||
* | ||
* @param Transport\Input $input | ||
*/ | ||
public function process(Transport\Input $input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace TNW\Salesforce\Synchronize\Transport\Calls\Delete; | ||
|
||
/** | ||
* Unit interface | ||
*/ | ||
interface OutputInterface | ||
{ | ||
/** | ||
* Do Unit syncronization to Salesforce object | ||
* | ||
* @param Transport\Output $output | ||
*/ | ||
public function process(Transport\Output $output); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
namespace TNW\Salesforce\Synchronize\Transport\Calls\Delete\Transport; | ||
|
||
use SplObjectStorage; | ||
use function spl_object_hash; | ||
|
||
/** | ||
* Upsert Transport Input | ||
*/ | ||
class Input extends SplObjectStorage | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $externalIdFieldName = ''; | ||
/** | ||
* @var string | ||
*/ | ||
protected $type = ''; | ||
/** | ||
* @var array | ||
*/ | ||
private $info = []; | ||
|
||
/** | ||
* Data constructor. | ||
* | ||
* @param string $type | ||
* @param string $externalIdFieldName | ||
*/ | ||
public function __construct($type = '', $externalIdFieldName = 'Id') | ||
{ | ||
$this->type = $type; | ||
$this->externalIdFieldName = $externalIdFieldName; | ||
} | ||
|
||
/** | ||
* External Id Field Name | ||
* | ||
* @return string | ||
*/ | ||
public function externalIdFieldName() | ||
{ | ||
return $this->externalIdFieldName; | ||
} | ||
|
||
/** | ||
* Type | ||
* | ||
* @return string | ||
*/ | ||
public function type() | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* Offset Get | ||
* | ||
* @param object $object | ||
* @return array | ||
*/ | ||
public function &offsetGet($object) | ||
{ | ||
if (!$this->contains($object)) { | ||
$this->offsetSet($object, []); | ||
} | ||
|
||
return $this->info[parent::offsetGet($object)]; | ||
} | ||
|
||
/** | ||
* Offset Set | ||
* | ||
* @param object $object | ||
* @param array $data | ||
*/ | ||
public function offsetSet($object, $data = null) | ||
{ | ||
$index = spl_object_hash($object); | ||
parent::offsetSet($object, $index); | ||
$this->info[$index] = $data; | ||
} | ||
|
||
/** | ||
* Get Info | ||
* | ||
* @return array | ||
*/ | ||
public function getInfo() | ||
{ | ||
return $this->info[parent::getInfo()]; | ||
} | ||
|
||
/** | ||
* Set Info | ||
* | ||
* @param array $data | ||
*/ | ||
public function setInfo($data) | ||
{ | ||
$index = spl_object_hash($this->current()); | ||
parent::setInfo($index); | ||
$this->info[$index] = $data; | ||
} | ||
|
||
/** | ||
* Offset Unset | ||
* | ||
* @param object $object | ||
*/ | ||
public function offsetUnset($object) | ||
{ | ||
unset($this->info[parent::offsetGet($object)]); | ||
parent::offsetUnset($object); | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
Synchronize/Transport/Calls/Delete/Transport/Output.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
namespace TNW\Salesforce\Synchronize\Transport\Calls\Delete\Transport; | ||
|
||
use SplObjectStorage; | ||
use function spl_object_hash; | ||
|
||
/** | ||
* Upsert Transport Output | ||
*/ | ||
class Output extends SplObjectStorage | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $type; | ||
/** | ||
* @var | ||
*/ | ||
protected $unit; | ||
/** | ||
* @var array | ||
*/ | ||
private $info = []; | ||
|
||
/** | ||
* Data constructor. | ||
* | ||
* @param string $type | ||
*/ | ||
public function __construct($type = '') | ||
{ | ||
$this->type = $type; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getUnit() | ||
{ | ||
return $this->unit; | ||
} | ||
|
||
/** | ||
* @param mixed $unit | ||
*/ | ||
public function setUnit($unit) | ||
{ | ||
$this->unit = $unit; | ||
} | ||
|
||
/** | ||
* Type | ||
* | ||
* @return string | ||
*/ | ||
public function type() | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* Offset Get | ||
* | ||
* @param object $object | ||
* @return array | ||
*/ | ||
public function &offsetGet($object) | ||
{ | ||
if (!$this->contains($object)) { | ||
$this->offsetSet($object, []); | ||
} | ||
|
||
return $this->info[parent::offsetGet($object)]; | ||
} | ||
|
||
/** | ||
* Offset Set | ||
* | ||
* @param object $object | ||
* @param array $data | ||
*/ | ||
public function offsetSet($object, $data = null) | ||
{ | ||
$index = spl_object_hash($object); | ||
parent::offsetSet($object, $index); | ||
$this->info[$index] = $data; | ||
} | ||
|
||
/** | ||
* Get Info | ||
* | ||
* @return array | ||
*/ | ||
public function getInfo() | ||
{ | ||
return $this->info[parent::getInfo()]; | ||
} | ||
|
||
/** | ||
* Set Info | ||
* | ||
* @param array $data | ||
*/ | ||
public function setInfo($data) | ||
{ | ||
$index = spl_object_hash($this->current()); | ||
parent::setInfo($index); | ||
$this->info[$index] = $data; | ||
} | ||
|
||
/** | ||
* Offset Unset | ||
* | ||
* @param object $object | ||
*/ | ||
public function offsetUnset($object) | ||
{ | ||
unset($this->info[parent::offsetGet($object)]); | ||
parent::offsetUnset($object); | ||
} | ||
} |
Oops, something went wrong.