setJournal() публичный Метод

Set journal
public setJournal ( Journal $journal = null ) : Board
$journal Journal
Результат Board
 public function importBoard($id, $newJournalId)
 {
     $settingsSql = "SELECT setting_value, locale FROM group_settings WHERE group_id = :id";
     $settingsStatement = $this->dbalConnection->prepare($settingsSql);
     $settingsStatement->bindValue('id', $id);
     $settingsStatement->execute();
     $results = $settingsStatement->fetchAll();
     if (count($results) == 0) {
         return null;
     }
     $journal = $this->em->getReference('OjsJournalBundle:Journal', $newJournalId);
     $board = new Board();
     $board->setJournal($journal);
     foreach ($results as $result) {
         $board->setCurrentLocale(mb_substr($result['locale'], 0, 2, 'UTF-8'));
         $board->setName($result['setting_value']);
     }
     return $board;
 }
Пример #2
0
 /**
  * @return RedirectResponse
  */
 public function otoGenerateAction(Request $request)
 {
     $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();
     $translator = $this->get('translator');
     $getEditorUsers = $em->getRepository(User::class)->findUsersByJournalRole(['ROLE_EDITOR', 'ROLE_CO_EDITOR', 'ROLE_SECTION_EDITOR']);
     usort($getEditorUsers, function ($a, $b) {
         return strcmp($a->getLastName(), $b->getLastName());
     });
     $board = new Board();
     $board->setJournal($journal);
     foreach ($this->getParameter('locale_support') as $localeCode) {
         $board->setCurrentLocale($localeCode)->setName($translator->trans('board', [], null, $localeCode))->setDescription($translator->trans('board', [], null, $localeCode));
     }
     $counter = 1;
     foreach ($getEditorUsers as $user) {
         $boardMember = new BoardMember();
         $boardMember->setBoard($board)->setUser($user)->setSeq($counter);
         $counter = $counter + 1;
         $board->addBoardMember($boardMember);
         $em->persist($boardMember);
     }
     $em->persist($board);
     $em->flush();
     $this->successFlashBag('successfully.created');
     return $this->redirectToRoute('ojs_journal_board_index', ['journalId' => $journal->getId()]);
 }