Пример #1
0
 /**
  * Send a raw transaction to the server and return the result.
  * @param  string                      $action           The javascript function for the transaction.
  * @param  array                       $readCollections  An array of collections to be locked for reading.
  * @param  array                       $writeCollections An array of collections to be locked for writing.
  * @param  array                       $parameters       An array of parameters for executing the transaction multiple times.
  * @throws TransactionManagerException
  * @return mixed
  */
 public function executeTransaction($action, $readCollections = array(), $writeCollections = array(), $parameters = array())
 {
     $transaction = $this->_toolbox->getTransactionObject();
     $transaction->setAction($action);
     $transaction->setReadCollections($readCollections);
     $transaction->setWriteCollections($writeCollections);
     if (!empty($parameters)) {
         $transaction->setParams($parameters);
     }
     //Send
     try {
         $result = $transaction->execute();
         return $result;
     } catch (\Exception $e) {
         $normalised = $this->_toolbox->normaliseDriverExceptions($e);
         throw new TransactionManagerException($normalised['message'], $normalised['code']);
     }
 }
Пример #2
0
 /**
  * @covers Paradox\Toolbox::getTransactionObject
  */
 public function testGetTransactionObject()
 {
     $transaction = $this->toolbox->getTransactionObject();
     $this->assertInstanceOf('triagens\\ArangoDb\\Transaction', $transaction, 'getTransactionObject() did not return a triagens\\ArangoDb\\Transaction');
 }