public function updateTagAction(Request $request, Tag $tag, $languageCode)
    {
        $this->denyAccessUnlessGranted('ez:tags:edit' . ($tag->isSynonym() ? 'synonym' : ''));

        $tagUpdateStruct = $this->tagsService->newTagUpdateStruct();
        $tagUpdateStruct->remoteId = $tag->remoteId;
        $tagUpdateStruct->alwaysAvailable = $tag->alwaysAvailable;

        foreach ($tag->keywords as $keywordLanguageCode => $keyword) {
            $tagUpdateStruct->setKeyword($keyword, $keywordLanguageCode);
        }

        $form = $this->createForm(
            TagUpdateType::class,
            $tagUpdateStruct,
            [
                'action' => $request->getPathInfo(),
                'languageCode' => $languageCode,
                'tag' => $tag,
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $updatedTag = $this->tagsService->updateTag($tag, $form->getData());

            $this->addFlashMessage('success', 'tag_updated', ['%tagKeyword%' => $updatedTag->keyword]);

            return $this->redirectToTag($updatedTag);
        }

        return $this->render(
            '@NetgenTags/admin/tag/update.html.twig',
            [
                'form' => $form->createView(),
                'tag' => $tag,
            ]
        );
    }
public function updateTagAction(Request $request, Tag $tag, $languageCode)
    {
        $this->denyAccessUnlessGranted('ez:tags:edit' . ($tag->isSynonym() ? 'synonym' : ''));

        $tagUpdateStruct = $this->tagsService->newTagUpdateStruct();
        $tagUpdateStruct->remoteId = $tag->remoteId;
        $tagUpdateStruct->alwaysAvailable = $tag->alwaysAvailable;

        foreach ($tag->keywords as $keywordLanguageCode => $keyword) {
            $tagUpdateStruct->setKeyword($keyword, $keywordLanguageCode);
        }

        $form = $this->createForm(
            TagUpdateType::class,
            $tagUpdateStruct,
            [
                'action' => $request->getPathInfo(),
                'languageCode' => $languageCode,
                'tag' => $tag,
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $updatedTag = $this->tagsService->updateTag($tag, $form->getData());

            $this->addFlashMessage('success', 'tag_updated', ['%tagKeyword%' => $updatedTag->keyword]);

            return $this->redirectToTag($updatedTag);
        }

        return $this->render(
            '@NetgenTags/admin/tag/update.html.twig',
            [
                'form' => $form->createView(),
                'tag' => $tag,
            ]
        );
    }
public function updateTagAction ( Request $ request , Tag $ tag , $ languageCode ) { $ this -> denyAccessUnlessGranted ( 'ez:tags:edit' . ( $ tag -> isSynonym ( ) ? 'synonym' : '' ) ) ; $ tagUpdateStruct = $ this -> tagsService -> newTagUpdateStruct ( ) ; $ tagUpdateStruct -> remoteId = $ tag -> remoteId ; $ tagUpdateStruct -> alwaysAvailable = $ tag -> alwaysAvailable ; foreach ( $ tag -> keywords as $ keywordLanguageCode => $ keyword ) { $ tagUpdateStruct -> setKeyword ( $ keyword , $ keywordLanguageCode ) ; } $ form = $ this -> createForm ( TagUpdateType :: class , $ tagUpdateStruct , [ 'action' => $ request -> getPathInfo ( ) , 'languageCode' => $ languageCode , 'tag' => $ tag , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ updatedTag = $ this -> tagsService -> updateTag ( $ tag , $ form -> getData ( ) ) ; $ this -> addFlashMessage ( 'success' , 'tag_updated' , [ '%tagKeyword%' => $ updatedTag -> keyword ] ) ; return $ this -> redirectToTag ( $ updatedTag ) ; } return $ this -> render ( '@NetgenTags/admin/tag/update.html.twig' , [ 'form' => $ form -> createView ( ) , 'tag' => $ tag , ] ) ; }
This method renders view with a form for updating a tag or synonym.
After form is being submitted, it updates the tag or synonym and redirects to it.

@param \Symfony\Component\HttpFoundation\Request $request
@param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag
@param string $languageCode

@return \Symfony\Component\HttpFoundation\Response
This method renders view with a form for updating a tag or synonym . After form is being submitted it updates the tag or synonym and redirects to it .