Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

exposing retrieveRequest #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/ET_DataExtension_Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class ET_DataExtension_Row extends ET_CUDWithUpsertSupport
* @var string Gets or sets the data extension customer key.
*/
public $CustomerKey;

/**
* Initializes a new instance of the class.
*/
Expand All @@ -43,20 +42,25 @@ public function get()
/**
* Post this instance.
* @return ET_Post Object of type ET_Post which contains http status code, response, etc from the POST SOAP service
* @param array $props Dictionary type array which may hold prepared stucture e.g. array('id' => '', 'key' => '')
*/
public function post()
public function post($props=array())
{
$this->getCustomerKey();
$originalProps = $this->props;
$overrideProps = array();
$fields = array();

foreach ($this->props as $key => $value){
$fields[] = array("Name" => $key, "Value" => $value);
}
$overrideProps['CustomerKey'] = $this->CustomerKey;
$overrideProps['Properties'] = array("Property"=> $fields);
if ($props) {
$overrideProps = $props;
} else {
$fields = array();

foreach ($this->props as $key => $value){
$fields[] = array("Name" => $key, "Value" => $value);
}
$overrideProps['CustomerKey'] = $this->CustomerKey;
$overrideProps['Properties'] = array("Property"=> $fields);

}
$this->props = $overrideProps;
$response = parent::post();
$this->props = $originalProps;
Expand Down
10 changes: 2 additions & 8 deletions src/ET_Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ class ET_Get extends ET_Constructor
* @param string $objType Object name, e.g. "ImportDefinition", "DataExtension", etc
* @param array $props Dictionary type array which may hold e.g. array('id' => '', 'key' => '')
* @param array $filter Dictionary type array which may hold e.g. array("Property"=>"", "SimpleOperator"=>"","Value"=>"")
* @param bool $getSinceLastBatch Gets or sets a boolean value indicating whether to get since last batch. true if get since last batch; otherwise, false.
* @param array $retrieveRequest Dictionary type array which may hold e.g. array("ClientIDs"=>array("ID"=>123))
*/
function __construct($authStub, $objType, $props, $filter, $getSinceLastBatch = false)
function __construct($authStub, $objType, $props, $filter, $retrieveRequest=array())
{
$authStub->refreshToken();
$rrm = array();
$request = array();
$retrieveRequest = array();

// If Props is not sent then Info will be used to find all retrievable properties
if (is_null($props)){
Expand Down Expand Up @@ -67,14 +66,9 @@ function __construct($authStub, $objType, $props, $filter, $getSinceLastBatch =
$retrieveRequest["Filter"] = new SoapVar($filter, SOAP_ENC_OBJECT, 'SimpleFilterPart', "http://exacttarget.com/wsdl/partnerAPI");
}
}
if ($getSinceLastBatch) {
$retrieveRequest["RetrieveAllSinceLastBatch"] = true;
}


$request["RetrieveRequest"] = $retrieveRequest;
$rrm["RetrieveRequestMsg"] = $request;

$return = $authStub->__soapCall("Retrieve", $rrm, null, null , $out_header);
parent::__construct($return, $authStub->__getLastResponseHTTPCode());

Expand Down
12 changes: 8 additions & 4 deletions src/ET_GetSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ class ET_GetSupport extends ET_BaseObject
*/
public function get()
{
$lastBatch = false;
if (property_exists($this,'getSinceLastBatch' )){
$lastBatch = $this->getSinceLastBatch;
$retrieveRequest=array();
if (property_exists($this,'retrieveRequest' )){
$retrieveRequest = $this->retrieveRequest;
}
$response = new ET_Get($this->authStub, $this->obj, $this->props, $this->filter, $lastBatch);
if (property_exists($this,'getSinceLastBatch')){
$retrieveRequest["RetrieveAllSinceLastBatch"] = $this->getSinceLastBatch;
}

$response = new ET_Get($this->authStub, $this->obj, $this->props, $this->filter, $retrieveRequest);
$this->lastRequestID = $response->request_id;
return $response;
}
Expand Down