本文整理汇总了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();
}
示例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');
}
示例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');
}
示例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);
}