<commit_before><?php

namespace OpenOrchestra\BackofficeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

/**
 * Class AdminController
 */
class AdminController extends Controller
{
    /**
     * Back Office
     *
     * @param string|null $siteId
     *
     * @Config\Route("", name="homepage")
     * @Config\Route("/{siteId}/homepage/{_locale}", name="homepage_with_site_id_and_language")
     *
     * @return Response
     */
    public function adminAction($siteId = null)
    {
        $contextManager = $this->get('open_orchestra_backoffice.context_manager');

        if ($siteId) {
            $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            $contextManager->setCurrentsite($site->getSiteId(), $site->getName(), $site->getDefaultLanguage());
        }

        return $this->render('OpenOrchestraBackofficeBundle:BackOffice:home.html.twig');
    }<commit_msg>add flashbag to controller<commit_after><?php

namespace OpenOrchestra\BackofficeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class AdminController
 */
class AdminController extends Controller
{
    /**
     * Back Office
     *
     * @param string|null $siteId
     *
     * @Config\Route("", name="homepage")
     * @Config\Route("/{siteId}/homepage/{_locale}", name="homepage_with_site_id_and_language")
     *
     * @return Response
     */
    public function adminAction(Request $request, $siteId = null)
    {
        if ($request->getMethod() == 'POST') {
            $this->get('session')->getFlashBag()->add('danger', $this->get('translator')->trans('open_orchestra_backoffice.form.javascript.error'));
        }

        $contextManager = $this->get('open_orchestra_backoffice.context_manager');

        if ($siteId) {
            $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            $contextManager->setCurrentsite($site->getSiteId(), $site->getName(), $site->getDefaultLanguage());
        }

        return $this->render('OpenOrchestraBackofficeBundle:BackOffice:home.html.twig');
    }
{'fraction_non_alphanumeric': 0.143687707641196, 'fraction_numerical': 0.0, 'mean_word_length': 3.8276553106212425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '4618678', 'n_tokens_mistral': 698, 'n_tokens_neox': 693, 'n_words': 98}