/** * Execute a Query in Salesforce API * * @param string $soql The Salesforce Object Query Language to execute * * @return \SimpleXMLElement */ public function query($soql) { $queryString = array('q' => $soql); $requestEvent = new QueryEvent($this->endpoint . 'query', $queryString); $this->client->dispatch(Events::QUERY, $requestEvent); $this->httpClient->setHeaders($this->getAuthorizationHeader()); $response = $this->httpClient->get('query', $queryString); $response = ResponseMediator::getContent($response); $this->client->dispatch(Events::RESPONSE, new ResponseEvent($requestEvent, $response->asXML())); return $response; }
/** * 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); } }