public function addSynonymAction(Request $request, $mainTagId, $languageCode)
    {
        $this->denyAccessUnlessGranted('ez:tags:addsynonym');

        $synonymCreateStruct = $this->tagsService->newSynonymCreateStruct($mainTagId, $languageCode);

        $form = $this->createForm(
            SynonymCreateType::class,
            $synonymCreateStruct,
            [
                'action' => $request->getPathInfo(),
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $newSynonym = $this->tagsService->addSynonym($form->getData());

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

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

        return $this->render(
            '@NetgenTags/admin/tag/add.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }
public function addSynonymAction(Request $request, $mainTagId, $languageCode)
    {
        $this->denyAccessUnlessGranted('ez:tags:addsynonym');

        $synonymCreateStruct = $this->tagsService->newSynonymCreateStruct($mainTagId, $languageCode);

        $form = $this->createForm(
            SynonymCreateType::class,
            $synonymCreateStruct,
            [
                'action' => $request->getPathInfo(),
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $newSynonym = $this->tagsService->addSynonym($form->getData());

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

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

        return $this->render(
            '@NetgenTags/admin/tag/add.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }
public function addSynonymAction ( Request $ request , $ mainTagId , $ languageCode ) { $ this -> denyAccessUnlessGranted ( 'ez:tags:addsynonym' ) ; $ synonymCreateStruct = $ this -> tagsService -> newSynonymCreateStruct ( $ mainTagId , $ languageCode ) ; $ form = $ this -> createForm ( SynonymCreateType :: class , $ synonymCreateStruct , [ 'action' => $ request -> getPathInfo ( ) , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ newSynonym = $ this -> tagsService -> addSynonym ( $ form -> getData ( ) ) ; $ this -> addFlashMessage ( 'success' , 'tag_added' , [ '%tagKeyword%' => $ newSynonym -> keyword ] ) ; return $ this -> redirectToTag ( $ newSynonym ) ; } return $ this -> render ( '@NetgenTags/admin/tag/add.html.twig' , [ 'form' => $ form -> createView ( ) , ] ) ; }
This method renders view with a form for adding new synonym.
After form is being submitted, it stores new synonym and redirects to it.

@param \Symfony\Component\HttpFoundation\Request $request
@param int|string $mainTagId
@param string $languageCode

@return \Symfony\Component\HttpFoundation\Response
This method renders view with a form for adding new synonym . After form is being submitted it stores new synonym and redirects to it .