当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseManager::rollback方法代码示例

本文整理汇总了PHP中Illuminate\Database\DatabaseManager::rollback方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::rollback方法的具体用法?PHP DatabaseManager::rollback怎么用?PHP DatabaseManager::rollback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager::rollback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * updates Activity Default values
  * @param array    $activityDefaults
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDefaults, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->changeActivityDefaultRepo->update($activityDefaults, $activity);
         $this->database->commit();
         $this->logger->info('Activity Default Values updated!', ['for' => $activityDefaults]);
         $this->dbLogger->activity("activity.activity_default_values", ['organization_id' => $this->auth->user()->organization->id, 'activity_id' => $activity->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['activityDefaultValues' => $activityDefaults]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:ChangeActivityDefaultManager.php

示例2: update

 /**
  * updates title and description of an activity
  * @param array    $activityDetails
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDetails, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->stepTwoRepo->update($activityDetails, $activity);
         $this->database->commit();
         $this->logger->info('Step Two Completed!', ['for' => [$activity->title, $activity->description]]);
         $this->logger->activity("activity.step_two_completed", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['stepTwo' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:StepTwoManager.php

示例3: update

 /**
  * update organization total expenditure
  * @param array            $totalExpenditure
  * @param OrganizationData $organizationData
  * @return bool
  */
 public function update(array $totalExpenditure, OrganizationData $organizationData)
 {
     try {
         $this->database->beginTransaction();
         $this->totalExpenditureRepo->update($totalExpenditure, $organizationData);
         $this->database->commit();
         $this->logger->info('Organization Total Expenditure Updated', ['for' => $organizationData->total_expenditure]);
         $this->dbLogger->activity("organization.total_expenditure_updated", ['name' => $this->auth->user()->organization->name]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['TotalExpenditure' => $totalExpenditure]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:TotalExpenditureManager.php

示例4: update

 /**
  * updates Activity Country Budget Items
  * @param array    $activityDetails
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDetails, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->CountryBudgetItemRepo->update($activityDetails, $activity);
         $this->database->commit();
         $this->logger->info('Activity Country Budget Items updated!', ['for' => $activity->country_budget_items]);
         $this->logger->activity("activity.country_budget_items", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['countryBudgetItems' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:CountryBudgetItemManager.php

示例5: upgrade

 /**
  * upgrade data version wise
  * @param $orgId
  * @param $version
  * @return bool
  */
 public function upgrade($orgId, $version)
 {
     try {
         $this->database->beginTransaction();
         $this->repo->upgrade($orgId, $version);
         $this->database->commit();
         $this->logger->info(sprintf('Version Upgraded to %s for Organization %s!', $version, $this->auth->user()->organization->name), ['for' => $orgId]);
         $this->dbLogger->activity("activity.version_upgraded", ['organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id, 'version' => $version]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['version' => $version]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:UpgradeManager.php

示例6: update

 /**
  * updates Activity Capital Spend
  * @param array    $activityDetails
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDetails, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->capitalSpendRepo->update($activityDetails, $activity);
         $this->database->commit();
         $this->logger->info('Activity Capital Spend updated!', ['for' => $activity->capital_spend]);
         $this->dbLogger->activity("activity.capital_spend", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['capitalSpend' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:CapitalSpendManager.php

示例7: update

 /**
  * update recipient region budget
  * @param array            $input
  * @param OrganizationData $organization
  * @return bool
  */
 public function update(array $input, OrganizationData $organization)
 {
     try {
         $this->database->beginTransaction();
         $this->repo->update($input, $organization);
         $this->database->commit();
         $this->logger->info('Organization Recipient Region Budget Updated', ['for' => $organization->recipient_region_budget]);
         $this->dbLogger->activity("organization.recipient_region_budget_updated", ['name' => $this->auth->user()->organization->name]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['OrganizationRecipientRegionBudget' => $input]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:RecipientRegionBudgetManager.php

示例8: update

 /**
  * updates Activity Default Aid Type
  * @param array    $activityDetails
  * @param Activity $activity
  * @return bool
  */
 public function update(array $activityDetails, Activity $activity)
 {
     try {
         $this->database->beginTransaction();
         $this->defaultAidTypeRepo->update($activityDetails, $activity);
         $this->database->commit();
         $this->logger->info('Activity Default Aid Type updated!', ['for' => $activity->default_aid_type]);
         $this->dbLogger->activity("activity.default_aid_type", ['activity_id' => $activity->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['defaultAidType' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:DefaultAidTypeManager.php

示例9: execute

 /**
  * @param object $command
  * @param callable $next
  *
  * @return mixed
  * @throws Exception
  */
 public function execute($command, callable $next)
 {
     $this->database->beginTransaction();
     try {
         $returnValue = $next($command);
         $this->database->commit();
     } catch (Exception $exception) {
         if ($exception instanceof IgnoresRollback) {
             $this->database->commit();
         } else {
             $this->database->rollback();
         }
         throw $exception;
     }
     return $returnValue;
 }
开发者ID:madewithlove,项目名称:tactician-laravel,代码行数:23,代码来源:TransactionMiddleware.php

示例10: update

 /**
  * Update Activity Result
  * @param array          $resultData
  * @param ActivityResult $activityResult
  * @return bool
  */
 public function update(array $resultData, ActivityResult $activityResult)
 {
     try {
         $this->database->beginTransaction();
         $resultExists = $activityResult->exists;
         $this->resultRepo->update($resultData, $activityResult);
         $this->database->commit();
         $this->logger->info(sprintf('Activity Result %s!', $resultExists ? 'updated' : 'saved'), ['for' => $activityResult->result]);
         $this->dbLogger->activity(sprintf("activity.result_%s", $resultExists ? 'updated' : 'saved'), ['activity_id' => $activityResult->activity_id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['result' => $resultData]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:22,代码来源:ResultManager.php

示例11: update

 /**
  * @param $id
  * @param $formData
  * @return bool
  */
 public function update($id, $formData)
 {
     $tags = [];
     if (isset($formData['tag'])) {
         $tags = $this->tag->createOrGet($formData['tag']);
     }
     $this->database->beginTransaction();
     try {
         $question = $this->find($id);
         if (!$question->update($formData)) {
             return false;
         }
         $question->tags()->sync($tags);
         $this->saveAnswers($formData, $question);
         $this->saveSubQuestions($formData, $question);
         $this->database->commit();
         return $question;
     } catch (\Exception $e) {
         dd($e);
         $this->database->rollback();
         return false;
     }
     $this->database->rollback();
     return false;
 }
开发者ID:Shuvayatra,项目名称:migration-web,代码行数:30,代码来源:QuestionService.php

示例12: update

 /**
  * @param $id
  * @param $formData
  * @return bool
  */
 public function update($id, $formData)
 {
     $this->db->beginTransaction();
     $journey = $this->find($id);
     try {
         if (isset($formData['featured_image'])) {
             $this->file->delete($journey->featured_image_path);
             $featured_image_info = $this->fileUpload->handle($formData['featured_image'], $this->uploadPath);
             $formData['featured_image'] = $featured_image_info['filename'];
         }
         if (isset($formData['menu_image'])) {
             $this->file->delete($journey->menu_image_path);
             $menu_image_info = $this->fileUpload->handle($formData['menu_image'], $this->uploadPath);
             $formData['menu_image'] = $menu_image_info['filename'];
         }
         if (isset($formData['small_menu_image'])) {
             $this->file->delete($journey->small_menu_image_path);
             $small_menu_image_info = $this->fileUpload->handle($formData['small_menu_image'], $this->uploadPath);
             $formData['small_menu_image'] = $small_menu_image_info['filename'];
         }
         $journey->update($formData);
         $this->saveSubcategory($formData, $journey);
         $this->updateSubcategory($formData);
         $this->db->commit();
         return true;
     } catch (Exception $e) {
         $this->db->rollback();
         return false;
     }
     return;
 }
开发者ID:Shuvayatra,项目名称:migration-web,代码行数:36,代码来源:JourneyService.php

示例13: save

 /**
  * @param $formData
  * @param $parent_id
  *
  * @return Category|bool
  */
 public function save($formData, $parent_id)
 {
     $formData['parent_id'] = $parent_id;
     try {
         if (isset($formData['main_image'])) {
             $main_image_info = $this->fileUpload->handle($formData['main_image'], $this->uploadPath);
             $main_image = $main_image_info['filename'];
             $formData['main_image'] = $main_image;
         }
         if (isset($formData['icon'])) {
             $icon_info = $this->fileUpload->handle($formData['icon'], $this->uploadPath);
             $icon = $icon_info['filename'];
             $formData['icon'] = $icon;
         }
         if (isset($formData['small_icon'])) {
             $small_icon_info = $this->fileUpload->handle($formData['small_icon'], $this->uploadPath);
             $small_icon = $small_icon_info['filename'];
             $formData['small_icon'] = $small_icon;
         }
         $category = $this->category->save($formData);
         return $category;
     } catch (Exception $e) {
         $this->db->rollback();
         return false;
     }
 }
开发者ID:Shuvayatra,项目名称:migration-web,代码行数:32,代码来源:CategoryService.php

示例14: store

 /**
  * save new activity from wizard
  * @param array $identifier
  * @param       $defaultFieldValues
  * @return bool
  */
 public function store(array $identifier, $defaultFieldValues)
 {
     try {
         $this->database->beginTransaction();
         $result = $this->activityRepo->store($identifier, $defaultFieldValues, $this->auth->user()->organization->id);
         $this->activityRepo->saveDefaultValues($result->id, $defaultFieldValues);
         $this->database->commit();
         $this->logger->info('Activity identifier added!', ['for' => $identifier['activity_identifier']]);
         $this->logger->activity("activity.activity_added", ['identifier' => $identifier['activity_identifier'], 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return $result;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['ActivityIdentifier' => $identifier]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:22,代码来源:ActivityManager.php

示例15: save

 /**
  * upload activity form csv
  * @param $activityCsv
  * @param $organization
  * @param $defaultFieldValues
  * @return bool
  */
 public function save($activityCsv, $organization, $defaultFieldValues)
 {
     try {
         $excel = $this->version->getExcel();
         $activitiesRows = $excel->load($activityCsv)->get();
         $activityDetails = [];
         foreach ($activitiesRows as $activityRow) {
             $activityDetails[] = $this->uploadActivityRepo->formatFromExcelRow($activityRow, $organization->id);
         }
         $identifiers = $this->uploadActivityRepo->getIdentifiers($organization->id);
         $this->database->beginTransaction();
         $data = [];
         foreach ($activityDetails as $activityDetail) {
             $activityIdentifier = $activityDetail['identifier']['activity_identifier'];
             isset($identifiers[$activityIdentifier]) ? $data[$identifiers[$activityIdentifier]] = $activityDetail : $this->uploadActivityRepo->upload($activityDetail, $organization, $defaultFieldValues);
             $this->database->commit();
         }
         if (count($data) > 0) {
             return view('Activity.confirmUpdate')->withData($data);
         }
         $this->logger->info("Activities Uploaded for organization with id:" . $organization->id);
         $this->dbLogger->activity("activity.activity_uploaded", ['organization_id' => $organization->id]);
         return true;
     } catch (Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['activity' => $activityDetails]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:36,代码来源:UploadActivityManager.php


注:本文中的Illuminate\Database\DatabaseManager::rollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。