/** * 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(); } }
/** * 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; }