public function updateAllAction(Request $request)
    {
        $dispatcher = $this->get('event_dispatcher');
        $event = new ResponseEvent($request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_UPDATEALL, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $em = $this->getDoctrine()->getManager();
        $form = $request->get('opifer_media_media');

        foreach ($form['files'] as $id => $values) {
            $media = $this->get('opifer.media.media_manager')->getRepository()->find($id);

            $form = $this->createForm('opifer_media_edit', $media);
            $form->submit($values);

            if ($form->isValid()) {
                $em->persist($media);
            }
        }

        $em->flush();

        $this->addFlash('success', 'The file(s) were added to the media library');

        return $this->redirectToRoute('opifer_media_media_index');
    }
public function updateAllAction(Request $request)
    {
        $dispatcher = $this->get('event_dispatcher');
        $event = new ResponseEvent($request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_UPDATEALL, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $em = $this->getDoctrine()->getManager();
        $form = $request->get('opifer_media_media');

        foreach ($form['files'] as $id => $values) {
            $media = $this->get('opifer.media.media_manager')->getRepository()->find($id);

            $form = $this->createForm('opifer_media_edit', $media);
            $form->submit($values);

            if ($form->isValid()) {
                $em->persist($media);
            }
        }

        $em->flush();

        $this->addFlash('success', 'The file(s) were added to the media library');

        return $this->redirectToRoute('opifer_media_media_index');
    }
public function updateAllAction ( Request $ request ) { $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ event = new ResponseEvent ( $ request ) ; $ dispatcher -> dispatch ( OpiferMediaEvents :: MEDIA_CONTROLLER_UPDATEALL , $ event ) ; if ( null !== $ event -> getResponse ( ) ) { return $ event -> getResponse ( ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ form = $ request -> get ( 'opifer_media_media' ) ; foreach ( $ form [ 'files' ] as $ id => $ values ) { $ media = $ this -> get ( 'opifer.media.media_manager' ) -> getRepository ( ) -> find ( $ id ) ; $ form = $ this -> createForm ( 'opifer_media_edit' , $ media ) ; $ form -> submit ( $ values ) ; if ( $ form -> isValid ( ) ) { $ em -> persist ( $ media ) ; } } $ em -> flush ( ) ; $ this -> addFlash ( 'success' , 'The file(s) were added to the media library' ) ; return $ this -> redirectToRoute ( 'opifer_media_media_index' ) ; }
Update multiple media items.

@param Request $request

@return Response
Update multiple media items .