|
@@ 202-221 (lines=20) @@
|
| 199 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
public function up(Application $app, $id) |
| 203 |
|
{ |
| 204 |
|
$this->isTokenValid($app); |
| 205 |
|
|
| 206 |
|
$repo = $app['orm.em']->getRepository('Eccube\Entity\Payment'); |
| 207 |
|
|
| 208 |
|
$current = $repo->find($id); |
| 209 |
|
$currentRank = $current->getRank(); |
| 210 |
|
|
| 211 |
|
$targetRank = $currentRank + 1; |
| 212 |
|
$target = $repo->findOneBy(array('rank' => $targetRank)); |
| 213 |
|
|
| 214 |
|
$app['orm.em']->persist($target->setRank($currentRank)); |
| 215 |
|
$app['orm.em']->persist($current->setRank($targetRank)); |
| 216 |
|
$app['orm.em']->flush(); |
| 217 |
|
|
| 218 |
|
$app->addSuccess('admin.rank.move.complete', 'admin'); |
| 219 |
|
|
| 220 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 221 |
|
} |
| 222 |
|
|
| 223 |
|
public function down(Application $app, $id) |
| 224 |
|
{ |
|
@@ 223-242 (lines=20) @@
|
| 220 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 221 |
|
} |
| 222 |
|
|
| 223 |
|
public function down(Application $app, $id) |
| 224 |
|
{ |
| 225 |
|
$this->isTokenValid($app); |
| 226 |
|
|
| 227 |
|
$repo = $app['orm.em']->getRepository('Eccube\Entity\Payment'); |
| 228 |
|
|
| 229 |
|
$current = $repo->find($id); |
| 230 |
|
$currentRank = $current->getRank(); |
| 231 |
|
|
| 232 |
|
$targetRank = $currentRank - 1; |
| 233 |
|
$target = $repo->findOneBy(array('rank' => $targetRank)); |
| 234 |
|
|
| 235 |
|
$app['orm.em']->persist($target->setRank($currentRank)); |
| 236 |
|
$app['orm.em']->persist($current->setRank($targetRank)); |
| 237 |
|
$app['orm.em']->flush(); |
| 238 |
|
|
| 239 |
|
$app->addSuccess('admin.rank.move.complete', 'admin'); |
| 240 |
|
|
| 241 |
|
return $app->redirect($app->url('admin_setting_shop_payment')); |
| 242 |
|
} |
| 243 |
|
} |
| 244 |
|
|