本文整理汇总了PHP中FOS\RestBundle\Request\ParamFetcherInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ParamFetcherInterface类的具体用法?PHP ParamFetcherInterface怎么用?PHP ParamFetcherInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParamFetcherInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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
示例5: 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
示例6: 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
示例7: 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
示例8: getCategoriesTreeAction
/**
* List all categories.
*
* @ApiDoc(
* description = "Get the collection of categories.",
* output = "PhpInk\Nami\CoreBundle\Util\Collection<PhpInk\Nami\CoreBundle\Model\CategoryInterface>",
* resource = true,
* statusCodes = {
* 200 = "Returned when successful"
* }
* )
* @Annotations\QueryParam(name="orderBy", map=true, requirements="[a-zA-Z0-9-\.]+", description="Sort by fields")
* @Annotations\QueryParam(name="filterBy", map=true, requirements="[a-zA-Z0-9-:\.\<\>\!\%+]+", description="Filters")
*
* ie: ?offset=2&limit=10&orderBy[name]=0&orderBy[locale]=en&filterBy[parent]=1
*
* @param ParamFetcherInterface $paramFetcher Param fetcher service
*
* @return array
*/
public function getCategoriesTreeAction(ParamFetcherInterface $paramFetcher)
{
/** @var \PhpInk\Nami\CoreBundle\Repository\Core\CategoryRepositoryInterface $categoryRepo */
$categoryRepo = $this->getRepository();
$categories = $categoryRepo->getCategoryTreePaginated($this->getLoggedUser(), $paramFetcher->get('orderBy'), $paramFetcher->get('filterBy'));
return $this->restView($categories);
}
开发者ID:phpink,项目名称:nami-core-bundle,代码行数:27,代码来源:CategoryController.php
示例9: 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
示例10: 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
示例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
示例16: getAllAction
/**
* REST GET list
*
* @QueryParam(
* name="offset",
* requirements="\d+",
* nullable=true,
* description="Starting from"
* )
* @QueryParam(
* name="limit",
* requirements="\d+",
* nullable=true,
* description="Number of items"
* )
* @ApiDoc(
* description="Get all notifications",
* resource=true
* )
*
* @param ParamFetcherInterface $paramFetcher param fetcher service
*
* @return Response
*/
public function getAllAction(ParamFetcherInterface $paramFetcher)
{
$offset = $paramFetcher->get('offset');
$start = null == $offset ? 0 : $offset + 1;
$limit = $paramFetcher->get('limit');
$notifications = $this->notificationProvider->getAll($start, $limit);
return new NotificationCollection($notifications, $offset, $limit);
}
开发者ID:zbox,项目名称:UnifiedPushBundle,代码行数:32,代码来源:NotificationController.php
示例17: logAction
/**
* Creates a log entry.
*
* @ApiDoc(
* section="AbcLoggerBundle",
* statusCodes = {
* 204 = "Returned on success",
* 400 = "Returned in case of a validation error"
* }
* )
*
* @Post("/log/{application}")
*
* @RequestParam(name="level", requirements="(emergency|alert|critical|error|warning|notice|info|debug)", description="The log level", strict=true, nullable=false)
* @RequestParam(name="message", description="The log message", strict=true, nullable=false)
* @RequestParam(name="context", description="The context map", nullable=true)
*
* @param string $application The name of the client application
* @param ParamFetcherInterface $paramFetcher
* @return void
*/
public function logAction($application, ParamFetcherInterface $paramFetcher)
{
$level = $paramFetcher->get('level');
$message = $paramFetcher->get('message');
$context = $paramFetcher->get('context');
$this->getRegistry()->get($application)->log($level, $message, $context == null ? [] : $context);
return null;
}
开发者ID:aboutcoders,项目名称:logger-bundle,代码行数:29,代码来源:LogController.php
示例18: cgetAction
/**
* @Get("")
* @ApiDoc(
* section="Topics"
* )
*
* @QueryParam(name="page", description="Page, 0-indexed.", default=0, requirements="\d+")
* @QueryParam(name="per_page", description="Elements per page. Maximum 1000.", default=10, requirements="\d+")
*
* @param ParamFetcherInterface $paramFetcher
* @return PaginatedResource
*/
public function cgetAction(ParamFetcherInterface $paramFetcher)
{
$handler = $this->get('un.topic_handler');
$page = (int) $paramFetcher->get('page');
$perPage = (int) $paramFetcher->get('per_page');
$paginator = $handler->getPaginated($page, $perPage);
return PaginatedResourceFactory::fromPaginator($paginator, $page);
}
开发者ID:spdionis,项目名称:un-webservice,代码行数:20,代码来源:TopicController.php
示例19: getCommentsAction
/**
* List all comments
*
* @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing notes.")
* @Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many notes to return.")
*
* @Annotations\View()
*
* @param Request $request
* @param ParamFetcherInterface $paramFetcher
*
* @return array
*/
public function getCommentsAction(Request $request, ParamFetcherInterface $paramFetcher)
{
$offset = $paramFetcher->get('offset');
$start = null == $offset ? 0 : $offset + 1;
$limit = $paramFetcher->get('limit');
$comments = $this->getDoctrine()->getRepository('TDomainBundle:Comment')->findAll();
return array('comments' => $comments, 'offset' => $offset, 'limit' => $limit);
}
开发者ID:dramentol,项目名称:capitest,代码行数:21,代码来源:CommentController.php
示例20: getLocationsAction
/**
*@Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing offres.")
*@Annotations\QueryParam(name="limit", requirements="\d+", default="5", description="How many offres to return.")
*
* @param Request $request
* @param ParamFetcherInterface $paramFetcher
* @return type
*/
public function getLocationsAction(Request $request, ParamFetcherInterface $paramFetcher)
{
$offset = $paramFetcher->get('offset');
$start = null == $offset ? 0 : $offset + 1;
$limit = $paramFetcher->get('limit');
$locations = $this->getDoctrine()->getRepository('AppBundle:Location')->findAll();
return array_slice($locations, $start, $limit, true);
}
开发者ID:pawelbienko,项目名称:rest-api-symfony2,代码行数:16,代码来源:LocationsController.php
注:本文中的FOS\RestBundle\Request\ParamFetcherInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论