public function kernelRequest(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        if (!$request->isMethod(Request::METHOD_PUT)) {
            return;
        }

        if (!$request->attributes->has('data')) {
            return;
        }

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

        if (!$data instanceof Access) {
            return;
        }

        $access = $data;
        $manager = $this->accessService->getManager();

        foreach ($access->getPermissions() as $permission) {
            $manager->remove($permission);
        }

        $manager->flush();
    }
public function kernelRequest(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        if (!$request->isMethod(Request::METHOD_PUT)) {
            return;
        }

        if (!$request->attributes->has('data')) {
            return;
        }

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

        if (!$data instanceof Access) {
            return;
        }

        $access = $data;
        $manager = $this->accessService->getManager();

        foreach ($access->getPermissions() as $permission) {
            $manager->remove($permission);
        }

        $manager->flush();
    }
public function kernelRequest ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ request -> isMethod ( Request :: METHOD_PUT ) ) { return ; } if ( ! $ request -> attributes -> has ( 'data' ) ) { return ; } $ data = $ request -> attributes -> get ( 'data' ) ; if ( ! $ data instanceof Access ) { return ; } $ access = $ data ; $ manager = $ this -> accessService -> getManager ( ) ; foreach ( $ access -> getPermissions ( ) as $ permission ) { $ manager -> remove ( $ permission ) ; } $ manager -> flush ( ) ; }
Remove the existing permissions on an update request

@param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
Remove the existing permissions on an update request