Ojs\JournalBundle\Controller\BoardController::addMemberAction PHP Method

addMemberAction() public method

add posted user id as board member with given board id
public addMemberAction ( Request $request, $boardId ) : RedirectResponse
$request Symfony\Component\HttpFoundation\Request
$boardId
return Symfony\Component\HttpFoundation\RedirectResponse
    public function addMemberAction(Request $request, $boardId)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'boards')) {
            throw new AccessDeniedException("You not authorized for edit this journal's board!");
        }
        $em = $this->getDoctrine()->getManager();
        $board = $em->getRepository('OjsJournalBundle:Board')->find($boardId);
        $boardMember = new BoardMember();
        $addMemberForm = $this->createAddMemberForm($boardMember, $board, $journal);
        $addMemberForm->handleRequest($request);
        if ($addMemberForm->isValid()) {
            $boardMember->setBoard($board);
            $em->persist($boardMember);
            $em->flush();
            $this->successFlashBag('successful.create');
        }
        return $this->redirectToRoute('ojs_journal_board_show', ['id' => $board->getId(), 'journalId' => $journal->getId()]);
    }