Created
November 2, 2015 21:27
-
-
Save araeuchle/984b1307ffcbbf8effd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function saveServiceDescriptionSortingAction(Request $request) | |
| { | |
| if ($request->isMethod('POST')) { | |
| $items = $request->request->all()['item']; | |
| $manager = $this->getDoctrine()->getManager(); | |
| $serviceDescriptionRepository = $manager->getRepository('SelfServiceBundle:PharmacyServiceDescription'); | |
| for ($i = 0; $i < count($items); $i++) { | |
| /** @var \Dav\SelfServiceBundle\Entity\Normal\PharmacyServiceDescription $description */ | |
| $description = $serviceDescriptionRepository->findOneBy([ | |
| 'id' => $items[$i] | |
| ]); | |
| if ($description !== null) { | |
| $description->setSorting($i); | |
| $manager->persist($description); | |
| } | |
| } | |
| $manager->flush(); | |
| } | |
| $this->addFlash( | |
| 'notice', | |
| 'Ihre Sortierung wurde erfolgreich gespeichert.' | |
| ); | |
| return new JsonResponse(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment