Example #1
0
 /**
  * @param MultiCallQueueInterface $queue
  * @param bool                    $throwsException
  *
  * @return array|false
  * @throws \Exception
  */
 public function multiCall(MultiCallQueueInterface $queue, $throwsException = true)
 {
     try {
         $this->checkSecurity();
         $actions = $this->getActions($queue);
         $results = $this->soapClient->multiCall($this->sessionId, $actions);
         $this->handleCallbacks($queue, $results);
         return $results;
     } catch (\Exception $e) {
         if ($throwsException) {
             throw $e;
         }
         return false;
     }
 }
 /**
  * Send pending calls to the prestashop soap api (with multiCall function).
  */
 public function sendCalls()
 {
     if (count($this->calls) > 0) {
         if ($this->isConnected()) {
             try {
                 $this->client->multiCall($this->session, $this->calls);
             } catch (\SoapFault $e) {
                 throw new RestCallException(sprintf('Error on Prestashop soap call : "%s". Called resources : "%s".', $e->getMessage(), json_encode($this->calls)));
             }
         } else {
             throw new NotConnectedException();
         }
         $this->calls = [];
     }
 }