<commit_before><?php

namespace Ojs\WorkflowBundle\Controller;

use APY\DataGridBundle\Grid\Column\ActionsColumn;
use APY\DataGridBundle\Grid\Source\Entity;
use Ojs\WorkflowBundle\Entity\ArticleWorkflowStep;
use Ojs\WorkflowBundle\Entity\JournalReviewForm;
use Ojs\WorkflowBundle\Entity\JournalWorkflowStep;
use Ojs\WorkflowBundle\Form\Type\JournalReviewFormType;
use Doctrine\ORM\QueryBuilder;
use Ojs\CoreBundle\Controller\OjsController as Controller;
use Ojs\CoreBundle\Params\ArticleFileParams;
use Ojs\JournalBundle\Entity\Article;
use Ojs\JournalBundle\Entity\ArticleFile;
use Ojs\JournalBundle\Entity\Journal;
use Ojs\JournalBundle\Form\Type\ArticleFileType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;

/**
 * Class JournalReviewFormController
 * @package Ojs\WorkflowBundle\Controller
 */
class JournalReviewFormController extends Controller
{
    /**
     * @param int $stepId
     * @return Response
     */
    public function indexAction($stepId)
    {
        $permisionService = $this->get('dp.workflow_permission_service');
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $em = $this->getDoctrine()->getManager();
        if(!$permisionService->isHaveEditorRole()){
            throw new AccessDeniedException;
        }
        $step = $em->getRepository(JournalWorkflowStep::class)->find($stepId);
        $this->throw404IfNotFound($step);

        $source = new Entity('OjsWorkflowBundle:JournalReviewForm');
        $tableAlias = $source->getTableAlias();
        $source->manipulateQuery(
            function (QueryBuilder $qb) use ($step, $tableAlias) {
                return $qb
                    ->where($tableAlias.'.step = :step')
                    ->setParameter('step', $step);
            }
        );

        $grid = $this->get('grid')->setSource($source);
        $gridAction = $this->get('grid_action');
        $actionColumn = new ActionsColumn("actions", 'actions');
        $rowAction[] = $gridAction->showAction(<commit_msg>Correct review form grid's query<commit_after><?php

namespace Ojs\WorkflowBundle\Controller;

use APY\DataGridBundle\Grid\Column\ActionsColumn;
use APY\DataGridBundle\Grid\Source\Entity;
use Ojs\WorkflowBundle\Entity\ArticleWorkflowStep;
use Ojs\WorkflowBundle\Entity\JournalReviewForm;
use Ojs\WorkflowBundle\Entity\JournalWorkflowStep;
use Ojs\WorkflowBundle\Form\Type\JournalReviewFormType;
use Doctrine\ORM\QueryBuilder;
use Ojs\CoreBundle\Controller\OjsController as Controller;
use Ojs\CoreBundle\Params\ArticleFileParams;
use Ojs\JournalBundle\Entity\Article;
use Ojs\JournalBundle\Entity\ArticleFile;
use Ojs\JournalBundle\Entity\Journal;
use Ojs\JournalBundle\Form\Type\ArticleFileType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;

/**
 * Class JournalReviewFormController
 * @package Ojs\WorkflowBundle\Controller
 */
class JournalReviewFormController extends Controller
{
    /**
     * @param int $stepId
     * @return Response
     */
    public function indexAction($stepId)
    {
        $permisionService = $this->get('dp.workflow_permission_service');
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $em = $this->getDoctrine()->getManager();
        if(!$permisionService->isHaveEditorRole()){
            throw new AccessDeniedException;
        }
        $step = $em->getRepository(JournalWorkflowStep::class)->find($stepId);
        $this->throw404IfNotFound($step);

        $source = new Entity('OjsWorkflowBundle:JournalReviewForm');
        $tableAlias = $source->getTableAlias();
        $source->manipulateQuery(
            function (QueryBuilder $qb) use ($step, $tableAlias) {
                return $qb
                    ->andWhere($tableAlias.'.step = :step')
                    ->setParameter('step', $step);
            }
        );

        $grid = $this->get('grid')->setSource($source);
        $gridAction = $this->get('grid_action');
        $actionColumn = new ActionsColumn("actions", 'actions');
        $rowAction[] = $gridAction->showAction(
{'fraction_non_alphanumeric': 0.12379912663755459, 'fraction_numerical': 0.0013100436681222707, 'mean_word_length': 3.909967845659164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4657633', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1283, 'n_words': 203}