|
@@ 147-158 (lines=12) @@
|
| 144 |
|
* @Security("has_role('ROLE_ADMIN')") |
| 145 |
|
* @ParamConverter("category", options={"mapping": {"slug": "slug"}}) |
| 146 |
|
*/ |
| 147 |
|
public function categoryUpAction(Request $request, Category $category) |
| 148 |
|
{ |
| 149 |
|
$entityManager = $this->getDoctrine()->getManager(); |
| 150 |
|
$repo = $entityManager->getRepository('AppBundle\Entity\Category'); |
| 151 |
|
if ($category->getParent()){ |
| 152 |
|
$repo->moveUp($category); |
| 153 |
|
$repo->verify(); |
| 154 |
|
$repo->recover(); |
| 155 |
|
$entityManager->flush(); |
| 156 |
|
} |
| 157 |
|
return $this->redirectToRoute('admin_categories'); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
/** |
| 161 |
|
* @Route("/category/down/{slug}", name="admin_category_down") |
|
@@ 166-177 (lines=12) @@
|
| 163 |
|
* @Security("has_role('ROLE_ADMIN')") |
| 164 |
|
* @ParamConverter("category", options={"mapping": {"slug": "slug"}}) |
| 165 |
|
*/ |
| 166 |
|
public function categoryDownAction(Request $request, Category $category) |
| 167 |
|
{ |
| 168 |
|
$entityManager = $this->getDoctrine()->getManager(); |
| 169 |
|
$repo = $entityManager->getRepository('AppBundle\Entity\Category'); |
| 170 |
|
if ($category->getParent()){ |
| 171 |
|
$repo->moveDown($category); |
| 172 |
|
$repo->verify(); |
| 173 |
|
$repo->recover(); |
| 174 |
|
$entityManager->flush(); |
| 175 |
|
} |
| 176 |
|
return $this->redirectToRoute('admin_categories'); |
| 177 |
|
} |
| 178 |
|
} |
| 179 |
|
|