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

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

Lists all Design entities.
public indexAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
Результат Symfony\Component\HttpFoundation\Response
    public function indexAction(Request $request)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('VIEW', $journal, 'design')) {
            throw new AccessDeniedException("You are not authorized for view this journal's designs!");
        }
        $source = new Entity('OjsJournalBundle:Design');
        $tableAlias = $source->getTableAlias();
        $source->manipulateQuery(function ($query) use($tableAlias, $journal) {
            $query->andWhere($tableAlias . '.owner = :journal')->setParameter('journal', $journal);
        });
        $source->manipulateRow(function (Row $row) use($request) {
            /* @var Design $entity */
            $entity = $row->getEntity();
            if (!is_null($entity)) {
                $entity->getOwner()->setDefaultLocale($request->getDefaultLocale());
                $row->setField('owner', $entity->getOwner()->getTitle());
            }
            return $row;
        });
        $grid = $this->get('grid')->setSource($source);
        $gridAction = $this->get('grid_action');
        $actionColumn = new ActionsColumn("actions", 'actions');
        $rowAction[] = $gridAction->showAction('ojs_journal_design_show', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->editAction('ojs_journal_design_edit', ['id', 'journalId' => $journal->getId()]);
        $rowAction[] = $gridAction->deleteAction('ojs_journal_design_delete', ['id', 'journalId' => $journal->getId()]);
        $actionColumn->setRowActions($rowAction);
        $grid->addColumn($actionColumn);
        $data = [];
        $data['grid'] = $grid;
        return $grid->getGridResponse('OjsJournalBundle:Design:index.html.twig', $data);
    }