本文整理汇总了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();
}
示例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);
}
示例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())]));
}
示例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));
}
}
示例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();
}
}
示例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();
}
示例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;
}
示例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'));
}