public function indexAction(Request $request)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$eventDispatcher = $this->get('event_dispatcher');
if (!$this->isGranted('VIEW', $journal, 'userRole')) {
throw new AccessDeniedException("You are not authorized for view this page");
}
$source = new Entity('OjsJournalBundle:JournalUser');
$source->manipulateRow(function (Row $row) use($request) {
/* @var JournalUser $entity */
$entity = $row->getEntity();
if (!is_null($entity)) {
$entity->getJournal()->setDefaultLocale($request->getDefaultLocale());
if (!is_null($entity)) {
$row->setField('journal', $entity->getJournal()->getTitle());
}
}
return $row;
});
$grid = $this->get('grid');
$grid->setSource($source);
$gridAction = $this->get('grid_action');
$rowAction = [];
$rowAction[] = $gridAction->editAction('ojs_journal_user_edit', ['journalId' => $journal->getId(), 'id']);
$rowAction[] = $gridAction->deleteAction('ojs_journal_user_delete', ['journalId' => $journal->getId(), 'id'], null, 'delete.journal_user');
$actionColumn = new ActionsColumn("actions", "actions");
$actionColumn->setRowActions($rowAction);
$grid->addColumn($actionColumn);
$listEvent = new ListEvent();
$listEvent->setGrid($grid);
$eventDispatcher->dispatch(JournalUserEvents::LISTED, $listEvent);
$grid = $listEvent->getGrid();
return $grid->getGridResponse('OjsJournalBundle:JournalUser:index.html.twig');
}