Пример #1
0
 /**
  * Flush all job batches
  *
  * @return void
  */
 protected function flushBatches()
 {
     $batches = $this->job->getBatches();
     foreach ($batches as $i => $batch) {
         $url = sprintf('job/%s/batch', $this->job->getId());
         $requestEvent = new CreateBatchEvent($this->client->getRestEndpoint() . $url, $batch->asXML());
         $this->client->dispatch(Events::CREATE_BATCH, $requestEvent);
         $response = $this->httpClient->post($url, $batch->asXML());
         $response = ResponseMediator::getContent($response);
         $this->client->dispatch(Events::RESPONSE, new ResponseEvent($requestEvent, $response->asXML()));
         $batches[$i]->fromXml($response);
     }
 }
Пример #2
0
 public function testShouldLoadDataFromXml()
 {
     $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>
         <jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
             <id>750D0000000002lIAA</id>
             <operation>insert</operation>
             <object>Account</object>
             <createdById>005D0000001ALVFIA4</createdById>
             <createdDate>2009-04-14T18:15:59.000Z</createdDate>
             <systemModstamp>2009-04-14T18:15:59.000Z</systemModstamp>
             <state>Open</state>
             <contentType>XML</contentType>
         </jobInfo>
     ');
     $job = new Job('Account');
     $job->fromXml($xml);
     $this->assertEquals('750D0000000002lIAA', $job->getId());
     $this->assertEquals('Open', $job->getState());
 }