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


PHP UserContext::getUser方法代码示例

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


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

示例1: removeAction

 /**
  * Remove a notification
  *
  * @param integer $id
  *
  * @return JsonResponse
  */
 public function removeAction($id)
 {
     $user = $this->userContext->getUser();
     if (null !== $user) {
         $this->manager->remove($user, $id);
     }
     return new JsonResponse();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:15,代码来源:NotificationController.php

示例2: countNotifications

 /**
  * Return the number of unread notifications for the currently logged in user
  *
  * @return int
  */
 public function countNotifications()
 {
     $user = $this->userContext->getUser();
     if (null === $user) {
         return 0;
     }
     return $this->manager->countUnreadForUser($user);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:NotificationExtension.php

示例3: sequentialEditAction

 /**
  * Action for product sequential edition
  * @param Request $request
  *
  * @AclAncestor("pim_enrich_product_edit_attributes")
  * @return RedirectResponse
  */
 public function sequentialEditAction(Request $request)
 {
     $sequentialEdit = $this->seqEditManager->createEntity($this->getObjects($request), $this->userContext->getUser());
     if ($this->seqEditManager->findByUser($this->userContext->getUser())) {
         return new RedirectResponse($this->router->generate('pim_enrich_product_index', ['dataLocale' => $request->get('dataLocale')]));
     }
     $this->seqEditManager->save($sequentialEdit);
     return new RedirectResponse($this->router->generate('pim_enrich_product_edit', ['dataLocale' => $request->get('dataLocale'), 'id' => current($sequentialEdit->getObjectSet())]));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:16,代码来源:SequentialEditController.php

示例4: onBuildAfter

 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $defaults = $this->context->getUser()->getProductGridFilters();
     if (empty($defaults)) {
         return;
     }
     $configuration = $event->getDatagrid()->getAcceptor()->getConfig();
     foreach ($configuration['filters']['columns'] as $code => $filter) {
         if (in_array($code, $this->disallowed)) {
             continue;
         }
         $configuration->offsetSetByPath(sprintf('%s[%s][enabled]', Configuration::COLUMNS_PATH, $code), in_array($code, $defaults));
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:17,代码来源:ConfigureProductFiltersListener.php

示例5: getCurrentScopeCode

 /**
  * Get current scope from datagrid parameters, then user config
  *
  * @return string
  */
 protected function getCurrentScopeCode()
 {
     $filterValues = $this->requestParams->get('_filter');
     if (isset($filterValues['scope']['value']) && $filterValues['scope']['value'] !== null) {
         return $filterValues['scope']['value'];
     } else {
         $channel = $this->userContext->getUser()->getCatalogScope();
         return $channel->getCode();
     }
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:15,代码来源:ContextConfigurator.php

示例6: removeAction

 /**
  * Remove a notification
  *
  * @param int $id
  *
  * @return JsonResponse
  */
 public function removeAction($id)
 {
     $user = $this->userContext->getUser();
     if (null !== $user) {
         $notification = $this->userNotifRepository->findOneBy(['id' => $id, 'user' => $user]);
         if ($notification) {
             $this->userNotifRemover->remove($notification);
         }
     }
     return new JsonResponse();
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:NotificationController.php

示例7: getCurrentScopeCode

 /**
  * Get current scope from datagrid parameters, then user config
  *
  * @return string
  */
 protected function getCurrentScopeCode()
 {
     $filterValues = $this->requestParams->get('_filter');
     $currentScopeCode = null;
     if (isset($filterValues['scope']['value'])) {
         $currentScopeCode = $filterValues['scope']['value'];
     }
     if (null === $currentScopeCode) {
         $requestFilters = $this->request->get('filters');
         if (isset($requestFilters['scope']['value'])) {
             $currentScopeCode = $requestFilters['scope']['value'];
         }
     }
     if (null === $currentScopeCode) {
         $channel = $this->userContext->getUser()->getCatalogScope();
         $currentScopeCode = $channel->getCode();
     }
     return $currentScopeCode;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:24,代码来源:ContextConfigurator.php

示例8: getAction

 /**
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function getAction(Request $request)
 {
     $sequentialEdit = $this->seqEditManager->findByUser($this->userContext->getUser());
     return new JsonResponse($this->normalizer->normalize($sequentialEdit, 'internal_api'));
 }
开发者ID:SamirBoulil,项目名称:pim-community-dev,代码行数:10,代码来源:SequentialEditController.php


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