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


PHP BaseController::isValidId方法代码示例

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


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

示例1: searchAction

 /**
  * Execute the "search" based on the criteria sent from the "index"
  * Returning a paginator for the results
  */
 public function searchAction($id)
 {
     if (!parent::isValidId($id)) {
         parent::redirect('ping');
     }
     $builder = $this->createSearchBuilder();
     $builder->where('ping.id = ' . $id);
     $ping = $builder->getQuery()->getSingleResult();
     if ($ping) {
         $this->view->ping = $ping;
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('ping');
     }
     #$this->view->disable();
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:20,代码来源:PingController.php

示例2: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('country');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $proxy = Proxy::findFirst($id);
         if ($proxy) {
             $proxy->setTransaction($transaction);
             $pings = $proxy->getPing();
             foreach ($pings as $ping) {
                 $ping->setTransaction($transaction);
                 $ping->delete();
             }
             $proxy->delete();
             $this->flash->success('Proxy deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Proxy not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting proxy.');
         $transaction->rollback();
     }
     return $this->redirect('proxy');
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:31,代码来源:ProxyController.php

示例3: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('url');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $url = Url::findFirst($id);
         if ($url) {
             $url->setTransaction($transaction);
             $batches = $url->getBatch();
             foreach ($batches as $batch) {
                 $batch->setTransaction($transaction);
                 $pings = $batch->getPing();
                 foreach ($pings as $ping) {
                     $ping->setTransaction($transaction);
                     $ping->delete();
                 }
                 $batch->delete();
             }
             $url->delete();
             $this->flash->success('Url deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Url not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting url.');
         $transaction->rollback($ex->getMessage());
     }
     return $this->redirect('url');
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:36,代码来源:UrlController.php

示例4: reloadAction

 public function reloadAction($id)
 {
     if (!parent::isValidId($id)) {
         $returnArg = '';
     } else {
         $batch = Batch::findFirst($id);
         if (!$batch) {
             $this->flash->error('Batch not found');
             $returnArg = '';
         } else {
             BatchHelper::reload($this->config, $batch);
             $returnArg = '?batchId=' . $id;
             $this->flash->success('Reloading pings...');
         }
     }
     return parent::redirect('batch' . $returnArg);
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:17,代码来源:BatchController.php


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