src/Flowcode/ShopBundle/Controller/AdminProductController.php
public function updateGalleryItemPosition(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $posArray = $request->get('data');

        $i = 0;
        foreach ($posArray as $item) {
            $entity = $em->getRepository('AmulenMediaBundle:GalleryItem')->find($item);
            $entity->setPosition($i);
            $i++;
        }
        $em->flush();
        return new Response('ok');
    }
public function updateGalleryItemPosition(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $posArray = $request->get('data');

        $i = 0;
        foreach ($posArray as $item) {
            $entity = $em->getRepository('AmulenMediaBundle:GalleryItem')->find($item);
            $entity->setPosition($i);
            $i++;
        }
        $em->flush();
        return new Response('ok');
    }
public function updateGalleryItemPosition ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ posArray = $ request -> get ( 'data' ) ; $ i = 0 ; foreach ( $ posArray as $ item ) { $ entity = $ em -> getRepository ( 'AmulenMediaBundle:GalleryItem' ) -> find ( $ item ) ; $ entity -> setPosition ( $ i ) ; $ i ++ ; } $ em -> flush ( ) ; return new Response ( 'ok' ) ; }
Actualizar la posicion de cada imagen.

@Route("/updatePosItem", name="admin_product_gallery_update_drag_drop")
@Method("POST")
Actualizar la posicion de cada imagen .