private function unlockOrLockUsers(Dropzone $dropzone, $unlock = true)
    {
        $this->get('icap.manager.dropzone_voter')->isAllowToOpen($dropzone);
        $this->get('icap.manager.dropzone_voter')->isAllowToEdit($dropzone);

        $dropRepo = $this->getDoctrine()->getManager()->getRepository('IcapDropzoneBundle:Drop');
        $drops = $dropRepo->findBy(['dropzone' => $dropzone->getId(), 'unlockedUser' => !$unlock]);

        foreach ($drops as $drop) {
            $drop->setUnlockedUser($unlock);
        }
        $em = $this->getDoctrine()->getManager();
        $em->flush();

        return $this->redirect(
            $this->generateUrl(
                'icap_dropzone_examiners',
                [
                    'resourceId' => $dropzone->getId(),
                ]
            )
        );
    }
private function unlockOrLockUsers(Dropzone $dropzone, $unlock = true)
    {
        $this->get('icap.manager.dropzone_voter')->isAllowToOpen($dropzone);
        $this->get('icap.manager.dropzone_voter')->isAllowToEdit($dropzone);

        $dropRepo = $this->getDoctrine()->getManager()->getRepository('IcapDropzoneBundle:Drop');
        $drops = $dropRepo->findBy(['dropzone' => $dropzone->getId(), 'unlockedUser' => !$unlock]);

        foreach ($drops as $drop) {
            $drop->setUnlockedUser($unlock);
        }
        $em = $this->getDoctrine()->getManager();
        $em->flush();

        return $this->redirect(
            $this->generateUrl(
                'icap_dropzone_examiners',
                [
                    'resourceId' => $dropzone->getId(),
                ]
            )
        );
    }
private function unlockOrLockUsers ( Dropzone $ dropzone , $ unlock = true ) { $ this -> get ( 'icap.manager.dropzone_voter' ) -> isAllowToOpen ( $ dropzone ) ; $ this -> get ( 'icap.manager.dropzone_voter' ) -> isAllowToEdit ( $ dropzone ) ; $ dropRepo = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( 'IcapDropzoneBundle:Drop' ) ; $ drops = $ dropRepo -> findBy ( [ 'dropzone' => $ dropzone -> getId ( ) , 'unlockedUser' => ! $ unlock ] ) ; foreach ( $ drops as $ drop ) { $ drop -> setUnlockedUser ( $ unlock ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'icap_dropzone_examiners' , [ 'resourceId' => $ dropzone -> getId ( ) , ] ) ) ; }
Factorised function for lock & unlock users in a dropzone.

@param Dropzone $dropzone
@param bool     $unlock

@return \Symfony\Component\HttpFoundation\RedirectResponse
Factorised function for lock & unlock users in a dropzone .