public function settingsAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse();
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $entity = (new GeneralEntity())
            ->setTaskScheduler($this->container->getParameter('task_scheduler.enabled'))
            ->setDefaultSearch($this->container->getParameter('anime_db.catalog.default_search'))
            ->setLocale($request->getLocale());

        /* @var $chain ChainSearch */
        $chain = $this->get('anime_db.plugin.search_fill');
        /* @var $form Form */
        $form = $this->createForm(new GeneralForm($chain), $entity)
            ->handleRequest($request);

        if ($form->isValid()) {
            // update params
            $this->get('anime_db.manipulator.parameters')
                ->set('task_scheduler.enabled', $entity->getTaskScheduler());
            $this->get('anime_db.manipulator.parameters')
                ->set('anime_db.catalog.default_search', $entity->getDefaultSearch());
            $this->get('anime_db.manipulator.parameters')
                ->set('locale', $entity->getLocale());
            $this->get('anime_db.app.listener.request')->setLocale($request, $entity->getLocale());
            $this->get('anime_db.cache_clearer')->clear();

            return $this->redirect($this->generateUrl('home_settings'));
        }

        return $this->render('AnimeDbCatalogBundle:Home:settings.html.twig', [
            'form' => $form->createView(),
        ], $response);
    }
public function settingsAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse();
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $entity = (new GeneralEntity())
            ->setTaskScheduler($this->container->getParameter('task_scheduler.enabled'))
            ->setDefaultSearch($this->container->getParameter('anime_db.catalog.default_search'))
            ->setLocale($request->getLocale());

        /* @var $chain ChainSearch */
        $chain = $this->get('anime_db.plugin.search_fill');
        /* @var $form Form */
        $form = $this->createForm(new GeneralForm($chain), $entity)
            ->handleRequest($request);

        if ($form->isValid()) {
            // update params
            $this->get('anime_db.manipulator.parameters')
                ->set('task_scheduler.enabled', $entity->getTaskScheduler());
            $this->get('anime_db.manipulator.parameters')
                ->set('anime_db.catalog.default_search', $entity->getDefaultSearch());
            $this->get('anime_db.manipulator.parameters')
                ->set('locale', $entity->getLocale());
            $this->get('anime_db.app.listener.request')->setLocale($request, $entity->getLocale());
            $this->get('anime_db.cache_clearer')->clear();

            return $this->redirect($this->generateUrl('home_settings'));
        }

        return $this->render('AnimeDbCatalogBundle:Home:settings.html.twig', [
            'form' => $form->createView(),
        ], $response);
    }
public function settingsAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; // response was not modified for this request if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ entity = ( new GeneralEntity ( ) ) -> setTaskScheduler ( $ this -> container -> getParameter ( 'task_scheduler.enabled' ) ) -> setDefaultSearch ( $ this -> container -> getParameter ( 'anime_db.catalog.default_search' ) ) -> setLocale ( $ request -> getLocale ( ) ) ; /* @var $chain ChainSearch */ $ chain = $ this -> get ( 'anime_db.plugin.search_fill' ) ; /* @var $form Form */ $ form = $ this -> createForm ( new GeneralForm ( $ chain ) , $ entity ) -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { // update params $ this -> get ( 'anime_db.manipulator.parameters' ) -> set ( 'task_scheduler.enabled' , $ entity -> getTaskScheduler ( ) ) ; $ this -> get ( 'anime_db.manipulator.parameters' ) -> set ( 'anime_db.catalog.default_search' , $ entity -> getDefaultSearch ( ) ) ; $ this -> get ( 'anime_db.manipulator.parameters' ) -> set ( 'locale' , $ entity -> getLocale ( ) ) ; $ this -> get ( 'anime_db.app.listener.request' ) -> setLocale ( $ request , $ entity -> getLocale ( ) ) ; $ this -> get ( 'anime_db.cache_clearer' ) -> clear ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'home_settings' ) ) ; } return $ this -> render ( 'AnimeDbCatalogBundle:Home:settings.html.twig' , [ 'form' => $ form -> createView ( ) , ] , $ response ) ; }
General settings.

@param Request $request

@return Response
General settings .