protected function _find($filter, $hydrationMode = ETCore::HYDRATE_ARRAY, $one = false) { $typeName = null; if ($filter instanceof ExactTarget_SimpleFilterPart) { $typeName = 'SimpleFilterPart'; } else { if ($filter instanceof ExactTarget_ComplexFilterPart) { $typeName = 'ComplexFilterPart'; } else { throw new ETException('First parameter must be of type ExactTarget_SimpleFilterPart or ExactTarget_ComplexFilterPart.'); } } $rr = new ExactTarget_RetrieveRequest(); $rr->ObjectType = "Subscriber"; $rr->Properties = $this->retrievableProperties(); $rr->Filter = ETCore::toSoapVar($filter, $typeName); $rr->Options = null; $rrm = new ExactTarget_RetrieveRequestMsg(); $rrm->RetrieveRequest = $rr; $result = $this->soapClient->Retrieve($rrm); ETCore::evaluateSoapResult($result); return $this->hydrate($result, $hydrationMode, $one); }
/** * Process the soap result and throw an exception if something went wrong * * @param type $result */ protected function evaluateResult($result) { ETCore::evaluateSoapResult($result); }
/** * Delete all records from this collection. */ public function delete() { $data = array(); if (count($this->data) === 0) { return true; } try { foreach ($this->data as $rec) { $data[] = $rec->toSoapVarForDelete(); } $result = ETCore::delete($data); ETCore::evaluateSoapResult($result); return true; } catch (Exception $e) { throw new ETException(__METHOD__ . ':' . __LINE__ . '|' . $e->getMessage()); } }
/** * Get all records from the table (data extension). * * @param integer $hydrationMode ETCore::HYDRATE_ARRAY will return an array * representation of the records in the table. * ETCore::HYDRATE_RECORD will return an * ETCollection that contains xxxObject objects. * @return mixed ETCollection or Array, depending on hydration mode. * @throws Exception */ public function findAll($hydrationMode = ETCore::HYDRATE_ARRAY) { try { $res = null; $rr = new ExactTarget_RetrieveRequest(); $rr->ObjectType = 'DataExtensionObject[' . $this->customerKey . ']'; $rr->Properties = $this->schema; $rr->Options = null; $rrm = new ExactTarget_RetrieveRequestMsg(); $rrm->RetrieveRequest = $rr; $result = $this->soapClient->Retrieve($rrm); ETCore::evaluateSoapResult($result); $records = array(); if (!property_exists($result, 'Results')) { $result->Results = array(); } if (!is_array($result->Results)) { $result->Results = array($result->Results); } foreach ($result->Results as $fields) { $record = array(); foreach ($fields->Properties->Property as $field) { $record[$field->Name] = $field->Value; } if (count($record) > 0) { $records[] = $record; } } if ($hydrationMode == ETCore::HYDRATE_ARRAY) { $res = $records; } else { $coll = new ETCollection(); foreach ($records as $record) { $eo = new $this->extensionObjectClassName(); $eo->fromArray($record); $coll->add($eo); } $res = $coll; } return $res; } catch (Exception $e) { throw new ETException(__METHOD__ . ':' . __LINE__ . '|' . $e->getMessage()); } }
/** * Delete the record from the list. */ public function delete() { $this->checkRequiredProperties($this->requiredProperties); $obj = $this->makeSoapVar(); $request = new ExactTarget_DeleteRequest(); $request->Options = null; $request->Objects = array($obj); $result = $this->soapClient->Delete($request); ETCore::evaluateSoapResult($result); return true; }