|
@@ 257-274 (lines=18) @@
|
| 254 |
|
* @Method("PUT") |
| 255 |
|
* @Route("/{_admin}/setting/shop/payment/{id}/up", requirements={"id" = "\d+"}, name="admin_setting_shop_payment_up") |
| 256 |
|
*/ |
| 257 |
|
public function up(Application $app, Payment $current) |
| 258 |
|
{ |
| 259 |
|
$this->isTokenValid($app); |
| 260 |
|
|
| 261 |
|
$currentRank = $current->getRank(); |
| 262 |
|
$targetRank = $currentRank + 1; |
| 263 |
|
|
| 264 |
|
$target = $this->paymentRepository->findOneBy(array('rank' => $targetRank)); |
| 265 |
|
|
| 266 |
|
$target->setRank($currentRank); |
| 267 |
|
$current->setRank($targetRank); |
| 268 |
|
|
| 269 |
|
$this->entityManager->flush(); |
| 270 |
|
|
| 271 |
|
$app->addSuccess('admin.rank.move.complete', 'admin'); |
| 272 |
|
|
| 273 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
/** |
| 277 |
|
* @Method("PUT") |
|
@@ 280-297 (lines=18) @@
|
| 277 |
|
* @Method("PUT") |
| 278 |
|
* @Route("/{_admin}/setting/shop/payment/{id}/down", requirements={"id" = "\d+"}, name="admin_setting_shop_payment_down") |
| 279 |
|
*/ |
| 280 |
|
public function down(Application $app, Payment $current) |
| 281 |
|
{ |
| 282 |
|
$this->isTokenValid($app); |
| 283 |
|
|
| 284 |
|
$currentRank = $current->getRank(); |
| 285 |
|
$targetRank = $currentRank - 1; |
| 286 |
|
|
| 287 |
|
$target = $this->paymentRepository->findOneBy(array('rank' => $targetRank)); |
| 288 |
|
|
| 289 |
|
$target->setRank($currentRank); |
| 290 |
|
$current->setRank($targetRank); |
| 291 |
|
|
| 292 |
|
$this->entityManager->flush(); |
| 293 |
|
|
| 294 |
|
$app->addSuccess('admin.rank.move.complete', 'admin'); |
| 295 |
|
|
| 296 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
/** |
| 300 |
|
* @Method("PUT") |