Ojs\JournalBundle\Entity\JournalTheme::setJournal PHP Method

setJournal() public method

Set journal
public setJournal ( Journal $journal )
$journal Journal
    public function setJournal($journal)
    {
        $this->journal = $journal;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * @param Request $request
  * @param int $id
  * @return RedirectResponse
  */
 public function cloneGlobalThemeAction(Request $request, $id)
 {
     $useTheme = $request->query->has('use') ? true : false;
     $themeType = $request->get('type');
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     if (!$this->isGranted('VIEW', $journal, 'theme')) {
         throw new AccessDeniedException("You are not authorized for view this page");
     }
     $em = $this->getDoctrine()->getManager();
     $theme = null;
     if ($themeType == 'journal') {
         //disable journal filter for get all journal themes
         $GLOBALS['Ojs\\JournalBundle\\Entity\\JournalTheme#journalFilter'] = false;
         $theme = $em->getRepository('OjsJournalBundle:JournalTheme')->find($id);
     } elseif ($themeType == 'global') {
         $theme = $em->getRepository('OjsAdminBundle:AdminJournalTheme')->find($id);
     }
     $this->throw404IfNotFound($theme);
     $clonedTheme = new JournalTheme();
     $clonedTheme->setJournal($journal)->setTitle($theme->getTitle() . ' [cloned]')->setCss($theme->getCss())->setPublic(false);
     $em->persist($clonedTheme);
     $em->flush();
     if ($useTheme) {
         $journal->setTheme($clonedTheme);
         $em->persist($journal);
         $em->flush();
         $this->successFlashBag('successfully.cloned.global.theme.and.used');
     } else {
         $this->successFlashBag('successfully.cloned.global.theme');
     }
     return $this->redirectToRoute('ojs_journal_theme_index', ['journalId' => $journal->getId()]);
 }
All Usage Examples Of Ojs\JournalBundle\Entity\JournalTheme::setJournal