<commit_before><?php

/**
 * This file is part of the Superdesk Web Publisher Web Renderer Bundle
 *
 * Copyright 2015 Sourcefabric z.u. and contributors.
 *
 * For the full copyright and license information, please see the
 * AUTHORS and LICENSE files distributed with this source code.
 *
 * @copyright 2015 Sourcefabric z.ú.
 * @license http://www.superdesk.org/license
 */

namespace SWP\WebRendererBundle\EventListener;

use Symfony\Component\EventDispatcher\GenericEvent;
use Doctrine\Bundle\DoctrineBundle\Registry;
use SWP\TemplatesSystem\Gimme\Context\Context;

class RoutePageListener
{
    /**
     * @var \Doctrine\Bundle\DoctrineBundle\Registry
     */
    protected $registryManager;

    /**
     * @var \SWP\TemplatesSystem\Gimme\Context\Context
     */
    protected $context;

    /**
     * @param Registry $registryManager
     * @param Context  $context
     */
    public function __construct(Registry $registryManager, Context $context) {
        $this->registryManager = $registryManager;
        $this->context = $context;
    }

    /**
     * Fill template engine context with informations about current page
     *
     * @param  GenericEvent $event
     */
    public function onRoutePage(GenericEvent $event)
    {
        $em = $this->registryManager->getManager();
        $page = $em->getRepository('SWP\WebRendererBundle\Entity\Page')
            ->getById($event->getArguments()['pageId'])
            ->getArrayResult();

        if (count($page)) {
            $page['route_name'] = $event->getArguments()['route_name'];
            $this->context->setCurrentPage($page[0]);
        }

        return;
    }
}
<commit_msg>added missing route_name param to page array<commit_after><?php

/**
 * This file is part of the Superdesk Web Publisher Web Renderer Bundle
 *
 * Copyright 2015 Sourcefabric z.u. and contributors.
 *
 * For the full copyright and license information, please see the
 * AUTHORS and LICENSE files distributed with this source code.
 *
 * @copyright 2015 Sourcefabric z.ú.
 * @license http://www.superdesk.org/license
 */

namespace SWP\WebRendererBundle\EventListener;

use Symfony\Component\EventDispatcher\GenericEvent;
use Doctrine\Bundle\DoctrineBundle\Registry;
use SWP\TemplatesSystem\Gimme\Context\Context;

class RoutePageListener
{
    /**
     * @var \Doctrine\Bundle\DoctrineBundle\Registry
     */
    protected $registryManager;

    /**
     * @var \SWP\TemplatesSystem\Gimme\Context\Context
     */
    protected $context;

    /**
     * @param Registry $registryManager
     * @param Context  $context
     */
    public function __construct(Registry $registryManager, Context $context) {
        $this->registryManager = $registryManager;
        $this->context = $context;
    }

    /**
     * Fill template engine context with informations about current page
     *
     * @param  GenericEvent $event
     */
    public function onRoutePage(GenericEvent $event)
    {
        $em = $this->registryManager->getManager();
        $page = $em->getRepository('SWP\WebRendererBundle\Entity\Page')
            ->getById($event->getArguments()['pageId'])
            ->getArrayResult();

        if (count($page)) {
            $page[0]['route_name'] = $event->getArguments()['route_name'];
            $this->context->setCurrentPage($page[0]);
        }

        return;
    }
}

{'fraction_non_alphanumeric': 0.11933174224343675, 'fraction_numerical': 0.0056682577565632455, 'mean_word_length': 2.912485414235706, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7058117', 'n_tokens_mistral': 963, 'n_tokens_neox': 924, 'n_words': 218}