Ojs\JournalBundle\Controller\ArticleController::indexAction PHP Метод

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

Lists all article entities for journal
public indexAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
Результат Symfony\Component\HttpFoundation\Response
    public function indexAction(Request $request)
    {
        $eventDispatcher = $this->get('event_dispatcher');
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $this->throw404IfNotFound($journal);
        if (!$this->isGranted('VIEW', $journal, 'articles')) {
            throw new AccessDeniedException("You not authorized for this page!");
        }
        $source = new Entity('OjsJournalBundle:Article');
        $source->manipulateRow(function (Row $row) use($request) {
            /** @var Article $entity */
            $entity = $row->getEntity();
            if (!is_null($entity)) {
                $entity->setDefaultLocale($request->getDefaultLocale());
                $doi = $entity->getDoi();
                if ($doi !== null) {
                    $row->setField('translations.title', $entity->getTitleTranslations() . ' / ' . $doi);
                } else {
                    $row->setField('translations.title', $entity->getTitleTranslations());
                }
            }
            return $row;
        });
        $grid = $this->get('grid')->setSource($source);
        $gridAction = $this->get('grid_action');
        $actionColumn = new ActionsColumn("actions", 'actions');
        $rowAction[] = $gridAction->showAction('ojs_journal_article_show', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->editAction('ojs_journal_article_edit', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->articleCitations($journal->getId());
        $rowAction[] = $gridAction->articleAuthors($journal->getId());
        $rowAction[] = $gridAction->articleFiles($journal->getId());
        $rowAction[] = $gridAction->deleteAction('ojs_journal_article_delete', ['id', 'journalId' => $journal->getId()]);
        $actionColumn->setRowActions($rowAction);
        $grid->addColumn($actionColumn);
        $grid->getColumn('numerator')->manipulateRenderCell(function ($value, $row, $router) use($journal) {
            if ($journal->getTitleAbbr() !== null) {
                return $journal->getTitleAbbr() . '.' . $value;
            } else {
                return $journal->getSlug() . '.' . $value;
            }
        });
        $listEvent = new ListEvent();
        $listEvent->setGrid($grid);
        $eventDispatcher->dispatch(ArticleEvents::LISTED, $listEvent);
        $grid = $listEvent->getGrid();
        return $grid->getGridResponse('OjsJournalBundle:Article:index.html.twig');
    }