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


PHP ParamFetcherInterface::get方法代码示例

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


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

示例1: getStatusKeaktifansAction

 /**
  * List all status_keaktifans.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing status_keaktifans.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many status_keaktifans to return.")
  *
  * @Annotations\View(
  *  templateVar="status_keaktifans"
  * )
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getStatusKeaktifansAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ais_status_keaktifan.status_keaktifan.handler')->all($limit, $offset);
 }
开发者ID:theredfoxfire,项目名称:ais-status-keaktifan-bundle,代码行数:29,代码来源:StatusKeaktifanController.php

示例2: getIncidentsAction

 /**
  * List all incidents.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @FOS\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing incidents.")
  * @FOS\QueryParam(name="limit", requirements="\d+", default="5", description="How many incidents to return.")
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getIncidentsAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('cert_unlp.ngen.incident.handler')->all([], [], $limit, $offset);
 }
开发者ID:CERTUNLP,项目名称:NgenBundle,代码行数:25,代码来源:IncidentController.php

示例3: getTagsAction

 /**
  * List all tags.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing tags.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many tags to return.")
  *
  * @Annotations\View(
  *  templateVar="tags"
  * )
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getTagsAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('acme_blog.tag.handler')->all($limit, $offset);
 }
开发者ID:roykiet,项目名称:symfony2_rest,代码行数:29,代码来源:TagController.php

示例4: getMessagesAction

 /**
  * List all messages.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing messages.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many messages to return.")
  *
  * @Annotations\View(
  *  templateVar="messages"
  * )
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getMessagesAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('markettrade_demo.message.handler')->all($limit, $offset);
 }
开发者ID:saracubillas,项目名称:Market-Trade-Processor-Messages,代码行数:29,代码来源:MessageController.php

示例5: getHighscoreAction

 /**
  * Get global highscore.
  *
  * @ApiDoc(
  *   resource = true,
  *   description = "Highscore",
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing level.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="10", description="How many users to return.")
  *
  * @author Benjamin Brandt
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  * @return array
  */
 public function getHighscoreAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('verbunden_blendoku.game.handler')->HighScore($limit, $offset);
 }
开发者ID:verbunden,项目名称:blendoku-api,代码行数:26,代码来源:StatsController.php

示例6: postUserSignInAction

 /**
  * Sign in users by pair username:password.
  *
  * @ApiDoc(
  *     views={"default", "user"},
  *     section="Security API",
  *     resource=true,
  *     resourceDescription="Sign in users by pair username:password.",
  *     statusCodes={
  *         200="Returned when successful",
  *         400="Returned when an error has occurred",
  *     }
  * )
  *
  * @Rest\Route("/sign-in", requirements={
  *     "_format": "json|xml"
  * })
  *
  * @Rest\RequestParam(name="username", requirements="[\w\-]+", nullable=false, description="Username")
  * @Rest\RequestParam(name="password", nullable=false, description="Password")
  *
  * @param ParamFetcherInterface $paramFetcher
  * @return View
  */
 public function postUserSignInAction(ParamFetcherInterface $paramFetcher)
 {
     $username = $paramFetcher->get('username');
     $password = $paramFetcher->get('password');
     /** @var EntityRepository $repository */
     $repository = $this->getDoctrine()->getManager()->getRepository('UserBundle:User');
     /** @var User $user */
     $user = $repository->findOneBy(['username' => $username]);
     if (!$user || !$this->validatePassword($user, $password)) {
         return new View(array('message' => 'User not found.'), 400);
     }
     if (!$user->isEnabled()) {
         return new View(array('message' => 'Account is disabled.'), 400);
     }
     if (!$user->isAccountNonLocked()) {
         return new View(array('message' => 'Account is locked.'), 400);
     }
     if (!$user->isAccountNonExpired()) {
         return new View(array('message' => 'Account is expired.'), 400);
     }
     if (!$user->isCredentialsNonExpired()) {
         return new View(array('message' => 'Credentials is expired.'), 400);
     }
     $this->generateToken($user);
     $this->getDoctrine()->getManager()->flush();
     $headers = array('Token' => $user->getApiToken(), 'ExpireAt' => $user->getApiTokenExpireAt()->format('c'), 'Username' => $user->getUsername());
     $view = new View(array_merge(array('user' => $user->getId()), $headers), 200, $headers);
     $this->setAuthInfoInCookie($headers, $view->getResponse(), $user->getApiTokenExpireAt());
     return $view;
 }
开发者ID:glavweb,项目名称:symfony-rest,代码行数:54,代码来源:SecurityApiController.php

示例7: dispatcheventAction

 /**
  * @REST\Post("/dispatchevent", name="api_dispatcher_dispatchevent", requirements={ "id"="\d+"})
  *
  * @REST\RequestParam(name="eventkey", requirements="[a-z]+", description="Event key")
  * @REST\RequestParam(name="eventvalue", description="Event value")
  *
  * @param ParamFetcherInterface $paramFetcher
  * @return array
  */
 public function dispatcheventAction(ParamFetcherInterface $paramFetcher)
 {
     $eventkey = $paramFetcher->get('eventkey');
     $eventvalue = $paramFetcher->get('eventvalue');
     $this->get('api.dispatcher')->dispatch($eventkey, $eventvalue);
     return [];
 }
开发者ID:acassan,项目名称:DispatcherService,代码行数:16,代码来源:DispatcherController.php

示例8: getAction

 /**
  * Get events for a school
  *
  * @ApiDoc(
  *   resource = true,
  *   description = "Get events for a school.",
  *   output="Ilios\CoreBundle\Classes\SchoolEvent",
  *   statusCodes = {
  *     200 = "List of school events",
  *   }
  * )
  *
  * @View(serializerEnableMaxDepthChecks=true)
  *
  * @param integer $id
  * @param ParamFetcherInterface $paramFetcher
  *
  * @return Response
  *
  * @QueryParam(
  *   name="from",
  *   requirements="\d+",
  *   description="Timestamp for first event from time."
  * )
  * @QueryParam(
  *   name="to",
  *   requirements="\d+",
  *   description="Time stamp for last event from time"
  * )
  */
 public function getAction($id, ParamFetcherInterface $paramFetcher)
 {
     $schoolHandler = $this->container->get('ilioscore.school.handler');
     $school = $schoolHandler->findSchoolBy(['id' => $id]);
     if (!$school) {
         throw new NotFoundHttpException(sprintf('The school \'%s\' was not found.', $id));
     }
     $fromTimestamp = $paramFetcher->get('from');
     $toTimestamp = $paramFetcher->get('to');
     $from = DateTime::createFromFormat('U', $fromTimestamp);
     $to = DateTime::createFromFormat('U', $toTimestamp);
     if (!$from) {
         throw new InvalidInputWithSafeUserMessageException("?from is missing or is not a valid timestamp");
     }
     if (!$to) {
         throw new InvalidInputWithSafeUserMessageException("?to is missing or is not a valid timestamp");
     }
     $result = $schoolHandler->findEventsForSchool($school->getId(), $from, $to);
     $authChecker = $this->get('security.authorization_checker');
     $result = array_filter($result, function ($entity) use($authChecker) {
         return $authChecker->isGranted('view', $entity);
     });
     //If there are no matches return an empty array
     $answer['events'] = $result ? array_values($result) : [];
     return $answer;
 }
开发者ID:Okami-,项目名称:ilios,代码行数:56,代码来源:SchooleventsController.php

示例9: cgetAction

 /**
  * Get all Filesystem entities.
  *
  * @View(serializerEnableMaxDepthChecks=true)
  *
  * @param Request $request
  * @param ParamFetcherInterface $paramFetcher
  * @return array|FOSView
  * @QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing notes.")
  * @QueryParam(name="limit", requirements="\d+", default="20", description="How many notes to return.")
  * @QueryParam(name="order_by", nullable=true, array=true, description="Order by fields. Must be an array ie. &order_by[name]=ASC&order_by[description]=DESC")
  * @QueryParam(name="filters", nullable=true, array=true, description="Filter by fields. Must be an array ie. &filters[id]=3")
  *
  * @Security("has_role('ROLE_FILEMANAGER_LIST')")
  */
 public function cgetAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     try {
         $offset = $paramFetcher->get('offset');
         $limit = $paramFetcher->get('limit');
         $order_by = $paramFetcher->get('order_by');
         $filters = !is_null($paramFetcher->get('filters')) ? $paramFetcher->get('filters') : array();
         $em = $this->getDoctrine()->getManager();
         /** @var FilesystemRepository $repository */
         $repository = $em->getRepository('XxamFilemanagerBundle:Filesystem');
         $entities = $repository->findBy($filters, $order_by, $limit, $offset);
         if ($entities) {
             //total:
             $total = $repository->getTotalcount($filters);
             $results = array();
             /** @var Filesystem $entity */
             foreach ($entities as $entity) {
                 $results[] = $entity->toGridObject($request->getSession()->get('timezone'));
             }
             return array('filesystems' => $results, 'limit' => $limit, 'offset' => $offset, 'totalCount' => $total);
         }
         return FOSView::create('Not Found', Codes::HTTP_NO_CONTENT);
     } catch (\Exception $e) {
         return FOSView::create($e->getMessage(), Codes::HTTP_INTERNAL_SERVER_ERROR);
     }
 }
开发者ID:julianstricker,项目名称:xxam,代码行数:41,代码来源:FilemanagerRESTController.php

示例10: getPrestasisAction

 /**
  * List all prestasis.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing prestasis.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many prestasis to return.")
  *
  * @Annotations\View(
  *  templateVar="prestasis"
  * )
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getPrestasisAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ais_prestasi.prestasi.handler')->all($limit, $offset);
 }
开发者ID:theredfoxfire,项目名称:ais-prestasi-bundle,代码行数:29,代码来源:PrestasiController.php

示例11: getArticletypesAction

 /**
  * List all ArticleTypes.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing ArticleTypes.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many ArticleTypes to return.")
  *
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getArticletypesAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null === $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ojs_api.article_type.handler')->all($limit, $offset);
 }
开发者ID:ulakjira,项目名称:ojs,代码行数:26,代码来源:ArticleTypeRestController.php

示例12: getPublishermanagersAction

 /**
  * List all PublisherManager.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing PublisherManager.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many PublisherManager to return.")
  *
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getPublishermanagersAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null === $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ojs_api.publisher_manager.handler')->all($limit, $offset);
 }
开发者ID:ulakjira,项目名称:ojs,代码行数:26,代码来源:PublisherManagerRestController.php

示例13: getBoardsAction

 /**
  * List all Boards.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing Boards.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many Boards to return.")
  *
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getBoardsAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null === $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ojs_api.journal_board.handler')->all($limit, $offset);
 }
开发者ID:ulakjira,项目名称:ojs,代码行数:26,代码来源:JournalBoardRestController.php

示例14: getAction

 /**
  * Get events for a user
  *
  * @ApiDoc(
  *   resource = true,
  *   description = "Get materials for a user.",
  *   output="Ilios\CoreBundle\Classes\UserMaterial",
  *   statusCodes = {
  *     200 = "List of user materials",
  *     204 = "No content. Nothing to list."
  *   },
  *   tags = {
  *     "beta"
  *   }
  * )
  * @QueryParam(
  *   name="before",
  *   nullable=true,
  *   requirements="\d+",
  *   description="Timestamp - all Materials before a date."
  * )
  * @QueryParam(
  *   name="after",
  *   nullable=true,
  *   requirements="\d+",
  *   description="Timestamp - all Materials after a date."
  * )
  *
  * @View(serializerEnableMaxDepthChecks=true)
  *
  * @param integer $id
  *
  * @return Response
  *
  *
  * @throws \Exception
  */
 public function getAction($id, ParamFetcherInterface $paramFetcher)
 {
     $manager = $this->container->get('ilioscore.user.manager');
     $user = $manager->findOneBy(['id' => $id]);
     if (!$user) {
         throw new NotFoundHttpException(sprintf('The user \'%s\' was not found.', $id));
     }
     $authChecker = $this->get('security.authorization_checker');
     if (!$authChecker->isGranted('view', $user)) {
         throw $this->createAccessDeniedException('Unauthorized access!');
     }
     $criteria = [];
     $beforeTimestamp = $paramFetcher->get('before');
     if (!is_null($beforeTimestamp)) {
         $criteria['before'] = DateTime::createFromFormat('U', $beforeTimestamp);
     }
     $afterTimestamp = $paramFetcher->get('after');
     if (!is_null($afterTimestamp)) {
         $criteria['after'] = DateTime::createFromFormat('U', $afterTimestamp);
     }
     $materials = $manager->findMaterialsForUser($user->getId(), $criteria);
     //If there are no matches return an empty array
     $answer['userMaterials'] = $materials ? array_values($materials) : [];
     return $answer;
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:62,代码来源:UsermaterialsController.php

示例15: getMahasiswaProfilesAction

 /**
  * List all mahasiswa_profiles.
  *
  * @ApiDoc(
  *   resource = true,
  *   statusCodes = {
  *     200 = "Returned when successful"
  *   }
  * )
  *
  * @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing mahasiswa_profiles.")
  * @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many mahasiswa_profiles to return.")
  *
  * @Annotations\View(
  *  templateVar="mahasiswa_profiles"
  * )
  *
  * @param Request               $request      the request object
  * @param ParamFetcherInterface $paramFetcher param fetcher service
  *
  * @return array
  */
 public function getMahasiswaProfilesAction(Request $request, ParamFetcherInterface $paramFetcher)
 {
     $offset = $paramFetcher->get('offset');
     $offset = null == $offset ? 0 : $offset;
     $limit = $paramFetcher->get('limit');
     return $this->container->get('ais_mahasiswa_profile.mahasiswa_profile.handler')->all($limit, $offset);
 }
开发者ID:theredfoxfire,项目名称:ais-mahasiswa-profile-bundle,代码行数:29,代码来源:MahasiswaProfileController.php


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