src/Phlexible/Bundle/UserBundle/Controller/GroupsController.php
public function renameAction(Request $request, $groupId)
    {
        $name = $request->get('name');

        $groupManager = $this->get('phlexible_user.group_manager');

        $group = $groupManager->find($groupId);
        $oldName = $group->getName();
        $group
            ->setName($name)
            ->setModifyUserId($this->getUser()->getId())
            ->setModifiedAt(new \DateTime());

        $groupManager->updateGroup($group);

        $this->get('phlexible_message.message_poster')
            ->post(UsersMessage::create('Group "'.$group->getName().'" updated.'));

        return new ResultResponse(true, "Group $oldName renamed to $name.");
    }
public function renameAction(Request $request, $groupId)
    {
        $name = $request->get('name');

        $groupManager = $this->get('phlexible_user.group_manager');

        $group = $groupManager->find($groupId);
        $oldName = $group->getName();
        $group
            ->setName($name)
            ->setModifyUserId($this->getUser()->getId())
            ->setModifiedAt(new \DateTime());

        $groupManager->updateGroup($group);

        $this->get('phlexible_message.message_poster')
            ->post(UsersMessage::create('Group "'.$group->getName().'" updated.'));

        return new ResultResponse(true, "Group $oldName renamed to $name.");
    }
public function renameAction ( Request $ request , $ groupId ) { $ name = $ request -> get ( 'name' ) ; $ groupManager = $ this -> get ( 'phlexible_user.group_manager' ) ; $ group = $ groupManager -> find ( $ groupId ) ; $ oldName = $ group -> getName ( ) ; $ group -> setName ( $ name ) -> setModifyUserId ( $ this -> getUser ( ) -> getId ( ) ) -> setModifiedAt ( new \ DateTime ( ) ) ; $ groupManager -> updateGroup ( $ group ) ; $ this -> get ( 'phlexible_message.message_poster' ) -> post ( UsersMessage :: create ( 'Group "' . $ group -> getName ( ) . '" updated.' ) ) ; return new ResultResponse ( true , "Group $oldName renamed to $name." ) ; }
Rename group.

@param Request $request
@param string  $groupId

@return JsonResponse
@Route("/{groupId}", name="users_groups_rename")
@Method("PATCH")
@ApiDoc(
description="Rename group",
requirements={
{"name"="name", "dataType"="string", "required"=true, "description"="Rename name"}
}
)
Rename group .