original_string: public function updateAction(Request $request, $id)
      {
          $em = $this->getDoctrine()->getManager();
  
          $permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
  
          if (!$permissionsGroup) {
              throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
          }
  
          $editForm = $this->createEditForm($permissionsGroup);
          $editForm->handleRequest($request);
  
          if ($editForm->isValid()) {
              
              $em->flush();
  
              return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', array('id' => $id)));
          }
          
          $deleteRoleScopesForm = array();
          foreach ($permissionsGroup->getRoleScopes() as $roleScope) {
              $deleteRoleScopesForm[$roleScope->getId()] = $this->createDeleteRoleScopeForm(
                      $permissionsGroup, $roleScope);
          }
          
          $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
  
          return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
              'entity'      => $permissionsGroup,
              'edit_form'   => $editForm->createView(),
              'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
              'delete_role_scopes_form' => array_map( function($form) { 
                  
                  return $form->createView(); 
              }, $deleteRoleScopesForm),
              'add_role_scopes_form' => $addRoleScopesForm->createView()
          ));
      }
code: public function updateAction(Request $request, $id)
      {
          $em = $this->getDoctrine()->getManager();
  
          $permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
  
          if (!$permissionsGroup) {
              throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
          }
  
          $editForm = $this->createEditForm($permissionsGroup);
          $editForm->handleRequest($request);
  
          if ($editForm->isValid()) {
              
              $em->flush();
  
              return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', array('id' => $id)));
          }
          
          $deleteRoleScopesForm = array();
          foreach ($permissionsGroup->getRoleScopes() as $roleScope) {
              $deleteRoleScopesForm[$roleScope->getId()] = $this->createDeleteRoleScopeForm(
                      $permissionsGroup, $roleScope);
          }
          
          $addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
  
          return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
              'entity'      => $permissionsGroup,
              'edit_form'   => $editForm->createView(),
              'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
              'delete_role_scopes_form' => array_map( function($form) { 
                  
                  return $form->createView(); 
              }, $deleteRoleScopesForm),
              'add_role_scopes_form' => $addRoleScopesForm->createView()
          ));
      }
code_tokens: public function updateAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ id ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } $ editForm = $ this -> createEditForm ( $ permissionsGroup ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ id ) ) ) ; } $ deleteRoleScopesForm = array ( ) ; foreach ( $ permissionsGroup -> getRoleScopes ( ) as $ roleScope ) { $ deleteRoleScopesForm [ $ roleScope -> getId ( ) ] = $ this -> createDeleteRoleScopeForm ( $ permissionsGroup , $ roleScope ) ; } $ addRoleScopesForm = $ this -> createAddRoleScopeForm ( $ permissionsGroup ) ; return $ this -> render ( 'ChillMainBundle:PermissionsGroup:edit.html.twig' , array ( 'entity' => $ permissionsGroup , 'edit_form' => $ editForm -> createView ( ) , 'expanded_roles' => $ this -> getExpandedRoles ( $ permissionsGroup -> getRoleScopes ( ) -> toArray ( ) ) , 'delete_role_scopes_form' => array_map ( function ( $ form ) { return $ form -> createView ( ) ; } , $ deleteRoleScopesForm ) , 'add_role_scopes_form' => $ addRoleScopesForm -> createView ( ) ) ) ; }
docstring: Edits an existing PermissionsGroup entity.
docstring_tokens: Edits an existing PermissionsGroup entity .