public function onRequest(GetResponseEvent $event) { if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) { // don't do anything if it's not the master request return; } $this->userService->userIpResolver($event->getRequest()); }
public function let($die, \Doctrine\ORM\EntityManager $em, \Symfony\Component\Routing\Router $router, UserService $userService, \Newscoop\Entity\Repository\AutoIdRepository $repository, \Newscoop\Entity\User $user) { $em->getRepository('Newscoop\\Entity\\AutoId')->willReturn($repository); $em->persist(Argument::any())->willReturn(true); $em->flush(Argument::any())->willReturn(true); $em->remove(Argument::any())->willReturn(true); $repository->getNextTranslationPhraseId()->willReturn('7'); $user->hasPermission('AddFile')->willReturn(true); $userService->getCurrentUser()->willReturn($user); $this->beConstructedWith(array('file_base_url' => "files/", 'file_directory' => realpath(__DIR__ . '/../../../newscoop/public/files') . '/', 'file_num_dirs_level_1' => 1000, 'file_num_dirs_level_2' => 1000), $em, $router, $userService); }
/** * Construct * * @param EntityManager $em Entity Manager * @param UserService $userService User Service * @param CacheService $cacheService Cache service */ public function __construct(EntityManager $em, UserService $userService, CacheService $cacheService) { $this->em = $em; $this->user = $userService->getCurrentUser(); $this->cacheService = $cacheService; }