/** * 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 the Job to the Salesforce * * @return void * * @throws \RuntimeException When user is not authenticated * @throws \LogicException When a job is not set */ public function flush() { if (!$this->client->isAuthenticated()) { throw new \RuntimeException('You must be authenticated!'); } if (!$this->job instanceof Job) { throw new \LogicException('You must set a Job for this bulk'); } $this->httpClient->setHeaders($this->getAuthorizationHeader()); $this->flushJob(); $this->flushBatches(); }