当前位置: 首页>>代码示例>>PHP>>正文


PHP EngineInterface::renderResponse方法代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::renderResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface::renderResponse方法的具体用法?PHP EngineInterface::renderResponse怎么用?PHP EngineInterface::renderResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Bundle\FrameworkBundle\Templating\EngineInterface的用法示例。


在下文中一共展示了EngineInterface::renderResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onResponse

 /**
  * Checking request and response and decide whether we need a redirect
  *
  * @param FilterResponseEvent $event
  */
 public function onResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     $response = $event->getResponse();
     if ($request->get(self::HASH_NAVIGATION_HEADER) || $request->headers->get(self::HASH_NAVIGATION_HEADER)) {
         $location = '';
         $isFullRedirect = false;
         if ($response->isRedirect()) {
             $location = $response->headers->get('location');
             if ($request->attributes->get('_fullRedirect') || !is_object($this->security->getToken())) {
                 $isFullRedirect = true;
             }
         }
         if ($response->isNotFound() || $response->getStatusCode() == 503 && !$this->isDebug) {
             $location = $request->getUri();
             $isFullRedirect = true;
         }
         if ($location) {
             $response = $this->templating->renderResponse('OroNavigationBundle:HashNav:redirect.html.twig', array('full_redirect' => $isFullRedirect, 'location' => $location));
         }
         // disable cache for ajax navigation pages and change content type to json
         $response->headers->set('Content-Type', 'application/json');
         $response->headers->addCacheControlDirective('no-cache', true);
         $response->headers->addCacheControlDirective('max-age', 0);
         $response->headers->addCacheControlDirective('must-revalidate', true);
         $response->headers->addCacheControlDirective('no-store', true);
         $event->setResponse($response);
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:34,代码来源:ResponseHashnavListener.php

示例2: associationsAction

 /**
  * Display association grids
  *
  * @param Request $request the request
  * @param integer $id      the product id (owner)
  *
  * @AclAncestor("pim_enrich_associations_view")
  *
  * @return Response
  */
 public function associationsAction(Request $request, $id)
 {
     $product = $this->findProductOr404($id);
     $this->productManager->ensureAllAssociationTypes($product);
     $associationTypes = $this->doctrine->getRepository('PimCatalogBundle:AssociationType')->findAll();
     return $this->templating->renderResponse('PimEnrichBundle:Association:_associations.html.twig', array('product' => $product, 'associationTypes' => $associationTypes, 'dataLocale' => $request->get('dataLocale', null)));
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:17,代码来源:AssociationController.php

示例3: indexAction

 public function indexAction(Request $request, $configurationId)
 {
     $configuration = $this->getConfigurationOr404($configurationId);
     $pagination = $this->createPagination($configuration, $request);
     $reports = $this->reportManager->getJobReportsByConfiguration($configuration, $pagination->getOffset(), $pagination->getPerPage());
     return $this->templating->renderResponse('AurejaJobQueueBundle:JobReport:index.html.twig', ['configuration' => $this->getConfigurationOr404($configurationId), 'pagination' => $pagination, 'reports' => $reports]);
 }
开发者ID:aistis-,项目名称:JobQueueBundle,代码行数:7,代码来源:JobReportController.php

示例4: onCoreRequest

 /**
  * @param GetResponseEvent $event
  */
 public function onCoreRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         return;
     }
     $token = $this->securityContext->getToken();
     if (!$token) {
         return;
     }
     if (!$token instanceof UsernamePasswordToken) {
         return;
     }
     $key = $this->helper->getSessionKey($this->securityContext->getToken());
     $request = $event->getRequest();
     $session = $event->getRequest()->getSession();
     $user = $this->securityContext->getToken()->getUser();
     if (!$session->has($key)) {
         return;
     }
     if ($session->get($key) === true) {
         return;
     }
     $state = 'init';
     if ($request->getMethod() == 'POST') {
         if ($this->helper->checkCode($user, $request->get('_code')) == true) {
             $session->set($key, true);
             return;
         }
         $state = 'error';
     }
     $event->setResponse($this->templating->renderResponse('SonataUserBundle:Admin:Security/two_step_form.html.twig', array('state' => $state)));
 }
开发者ID:lordrhodos,项目名称:SonataUserBundle,代码行数:35,代码来源:RequestListener.php

示例5: loginAction

 public function loginAction(Request $request)
 {
     $form = $this->formFactory->create(LoginType::class);
     if ($error = $this->getAuthenticationError($request)) {
         $form->addError(new FormError($error->getMessage()));
     }
     return $this->templating->renderResponse('Security/login.html.twig', ['form' => $form->createView()]);
 }
开发者ID:havvg,项目名称:symfony-havvg-edition,代码行数:8,代码来源:SecurityController.php

示例6: details

 public function details($token, $requestIndex)
 {
     $this->profiler->disable();
     $profile = $this->profiler->loadProfile($token);
     $logs = $profile->getCollector('contentful')->getLogs();
     $logEntry = $logs[$requestIndex];
     return $this->templating->renderResponse('@Contentful/Collector/details.html.twig', ['requestIndex' => $requestIndex, 'entry' => $logEntry]);
 }
开发者ID:contentful,项目名称:ContentfulBundle,代码行数:8,代码来源:ProfilerController.php

示例7: modalAction

 public function modalAction(Request $request)
 {
     $image = null;
     if (null !== ($filename = $request->get('filename', null))) {
         $image = $this->imageManager->findByFilename($filename);
     }
     return $this->templating->renderResponse('SilvestraMediaBundle:Form:modal.html.twig', array('image' => $image));
 }
开发者ID:silvestra,项目名称:silvestra,代码行数:8,代码来源:ImageController.php

示例8: completenessAction

 /**
  * Displays completeness for a product
  *
  * @param int $id
  *
  * @return Response
  */
 public function completenessAction($id)
 {
     $product = $this->productManager->getProductRepository()->getFullProduct($id);
     $channels = $this->channelManager->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode());
     return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', array('product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses));
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:CompletenessController.php

示例9: onJobCreated

 /**
  * @param JobEvent $jobEvent
  */
 public function onJobCreated(JobEvent $jobEvent)
 {
     $job = $jobEvent->getJob();
     // Notification message to User
     $this->jobBoardMailer->sendMessage(sprintf('The job %s has been Sent', $job->getTitle()), 'no-reply@hossamyoussef.com', $job->getEmail(), $this->templating->renderResponse('Email/user.html.twig', array('job' => $job)));
     // Notification message to Job-Board Moderator
     $this->jobBoardMailer->sendMessage(sprintf('The job %s has been created', $job->getTitle()), 'no-reply@hossamyoussef.com', 'admin@hossamyoussef.com', $this->templating->renderResponse('Email/moderator.html.twig', array('job' => $job)));
 }
开发者ID:HossamYoussef2009,项目名称:JobBoard,代码行数:11,代码来源:JobEmailListener.php

示例10: createAction

 public function createAction()
 {
     $productFromAdmin = new ProductFromAdmin();
     $productData = Product::instantiateFromAdmin($productFromAdmin);
     //        $productData = new ProductFromAdmin();
     //        $productData->name = 'Wat NU?';
     return $this->templateEngine->renderResponse('AppBundle:admin:productStore.html.twig', array('product' => $productData));
 }
开发者ID:dev-learning,项目名称:webshop,代码行数:8,代码来源:ProductController.php

示例11: render

 /**
  * {@inheritdoc}
  */
 public function render(ReportInterface $report, Data $data)
 {
     if (null !== $data->getData()) {
         $data = array('report' => $report, 'values' => $data->getData(), 'labels' => $data->getLabels(), 'fields' => array_keys($data->getData()));
         $rendererConfiguration = $report->getRendererConfiguration();
         return $this->templating->renderResponse($rendererConfiguration["template"], array('data' => $data, 'configuration' => $rendererConfiguration));
     }
     return $this->templating->renderResponse("SyliusReportBundle::noDataTemplate.html.twig", array('report' => $report));
 }
开发者ID:nmarmon,项目名称:Sylius,代码行数:12,代码来源:TableRenderer.php

示例12: itemAction

 public function itemAction($id)
 {
     try {
         $item = $this->manager->getItem($id);
     } catch (NotFoundException $e) {
         throw new NotFoundHttpException($e->getMessage());
     }
     return $this->templating->renderResponse($this->templateItem, ['item' => $item]);
 }
开发者ID:4devs,项目名称:CatalogBundle,代码行数:9,代码来源:DefaultController.php

示例13: indexAction

 /**
  * @param Request $request
  *
  * @return Response
  */
 public function indexAction(Request $request)
 {
     $channelCode = $request->query->get('channel');
     /** @var ChannelInterface $channel */
     $channel = $this->findChannelByCodeOrFindFirst($channelCode);
     if (null === $channel) {
         return new RedirectResponse($this->router->generate('sylius_admin_channel_create'));
     }
     $statistics = $this->statisticsProvider->getStatisticsForChannel($channel);
     return $this->templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $statistics, 'channel' => $channel]);
 }
开发者ID:sylius,项目名称:sylius,代码行数:16,代码来源:DashboardController.php

示例14: registerForm

 public function registerForm(Request $request)
 {
     if ($this->pageStack->isLoggedIn()) {
         return $this->templating->renderResponse('JarvesBundle:User:logout.html.twig');
     }
     $user = new User();
     $form = $this->formFactory->createBuilder()->setData($user)->add('email', EmailType::class)->add('password', PasswordType::class)->add('save', SubmitType::class, array('label' => 'Register'))->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
     }
     return $this->templating->renderResponse('JarvesBundle:User:register.html.twig', ['form' => $form->createView()]);
 }
开发者ID:jarves,项目名称:jarves,代码行数:12,代码来源:UserLogin.php

示例15: renderResponse

 /**
  * {@inheritdoc}
  */
 public function renderResponse($data = null)
 {
     if (false === is_array($data)) {
         throw new \InvalidArgumentException('Data should be an array');
     }
     if (false === array_key_exists('template', $data)) {
         throw new \InvalidArgumentException('Data should contain a "template" key');
     }
     if (false === array_key_exists('parameters', $data)) {
         throw new \InvalidArgumentException('Data should contain a "parameters" key');
     }
     return $this->templating->renderResponse($data['template'], $data['parameters']);
 }
开发者ID:knplabs,项目名称:rad-view-renderer,代码行数:16,代码来源:TwigRenderer.php


注:本文中的Symfony\Bundle\FrameworkBundle\Templating\EngineInterface::renderResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。