示例#1
0
 /**
  * Saves all possible post variables
  *
  * @param \Bullhorn\FastRest\Api\Services\Acl\AclInterface $acl
  *
  * @return bool if anything was changed
  *
  * @throws \Exception
  */
 public function process($acl)
 {
     $transactionManager = new Transaction();
     $transactionManager->begin();
     $transaction = $transactionManager->getTransaction();
     $this->getEntity()->setTransaction($transaction);
     try {
         $acl->canWrite($this->getEntity());
         $this->getEntity()->fireEvent(self::EVENT_DATA_PROPAGATION_DELETE);
         $this->getEntity()->delete();
         $this->getEntity()->fireEvent(Save::EVENT_DATA_FINAL_CLEANUP);
         $transactionManager->commit();
     } catch (TransactionException $e) {
         $transactionManager->rollback();
     }
 }
示例#2
0
 /**
  * Saves all possible post variables
  * @param \stdClass $postParams
  * @return bool if anything was changed
  * @throws Exception
  * @throws \Exception
  */
 public function process(\stdClass $postParams)
 {
     $transactionManager = new Transaction();
     $transactionManager->begin();
     $transaction = $transactionManager->getTransaction();
     $isChanged = false;
     try {
         $isChanged = $this->saveFieldsRecursive($postParams, $this->getEntity(), $this->isCreating(), $transaction);
         $transactionManager->commit();
     } catch (TransactionException $e) {
         $transactionManager->rollback();
     } catch (\Exception $e) {
         $transactionManager->rollback();
         throw $e;
     }
     return $isChanged;
 }
示例#3
0
 /**
  * Used to be able to make a call inside of a transaction
  * @return \Phalcon\Db\AdapterInterface
  */
 public function selectReadConnection()
 {
     $transaction = new Transaction($this->getReadConnectionService());
     if ($transaction->isInTransaction()) {
         return $transaction->getTransaction()->getConnection();
     } else {
         return $this->getReadConnection();
     }
 }