本文整理汇总了PHP中Tobscure\JsonApi\Document::setMeta方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::setMeta方法的具体用法?PHP Document::setMeta怎么用?PHP Document::setMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tobscure\JsonApi\Document
的用法示例。
在下文中一共展示了Document::setMeta方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = Judge::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['startgroup', 'user', 'performance-score']));
$resource = $resource->fields($params->getFields(['judge' => Judge::getSerializer()->getFields(), 'startgroup' => Startgroup::getSerializer()->getFields(), 'user' => User::getSerializer()->getFields(), 'performance-score' => PerformanceScore::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
$document->setMeta(['total' => $data->getNbResults(), 'first' => $data->getFirstPage(), 'next' => $data->getNextPage(), 'previous' => $data->getPreviousPage(), 'last' => $data->getLastPage()]);
// return response
return new JsonResponse($document->toArray());
}
示例2: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = Startgroup::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['competition', 'event', 'performance-total-statistic', 'performance-execution-statistic', 'performance-choreography-statistic', 'performance-music-and-timing-statistic', 'routines', 'judges', 'routines.performance-total-statistic', 'routines.performance-execution-statistic', 'routines.performance-choreography-statistic', 'routines.performance-music-and-timing-statistic', 'routines.performance-scores', 'routines.performance-scores.judge']));
$resource = $resource->fields($params->getFields(['startgroup' => Startgroup::getSerializer()->getFields(), 'competition' => Competition::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'performance-total-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-execution-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-choreography-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-music-and-timing-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'routine' => Routine::getSerializer()->getFields(), 'judge' => Judge::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
$document->setMeta(['total' => $data->getNbResults(), 'first' => $data->getFirstPage(), 'next' => $data->getNextPage(), 'previous' => $data->getPreviousPage(), 'last' => $data->getLastPage()]);
// return response
return new JsonResponse($document->toArray());
}
示例3: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = RegionArea::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['types']));
$resource = $resource->fields($params->getFields(['region-area' => RegionArea::getSerializer()->getFields(), 'type' => RegionType::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
if ($params->getPage('size') != -1) {
$document->setMeta(['total' => $data->getNbResults(), 'first' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getFirstPage()]]), 'next' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getNextPage()]]), 'previous' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getPreviousPage()]]), 'last' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getLastPage()]])]);
}
// return response
return new JsonResponse($document->toArray());
}
示例4: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = Skill::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['sport', 'variations', 'variation-of', 'multiples', 'multiple-of', 'object', 'start-position', 'end-position', 'featured-picture', 'featured-video', 'featured-tutorial', 'kstruktur-root', 'function-phase-root', 'children', 'parents', 'parts', 'composites', 'groups', 'references', 'lineages', 'pictures', 'videos', 'kstrukturs', 'function-phases', 'sport.skills']));
$resource = $resource->fields($params->getFields(['skill' => Skill::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'variation' => Skill::getSerializer()->getFields(), 'variation-of' => Skill::getSerializer()->getFields(), 'multiple' => Skill::getSerializer()->getFields(), 'multiple-of' => Skill::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'start-position' => Position::getSerializer()->getFields(), 'end-position' => Position::getSerializer()->getFields(), 'featured-picture' => Picture::getSerializer()->getFields(), 'featured-video' => Video::getSerializer()->getFields(), 'featured-tutorial' => Video::getSerializer()->getFields(), 'kstruktur-root' => Kstruktur::getSerializer()->getFields(), 'function-phase-root' => FunctionPhase::getSerializer()->getFields(), 'child' => Skill::getSerializer()->getFields(), 'parent' => Skill::getSerializer()->getFields(), 'part' => Skill::getSerializer()->getFields(), 'composite' => Skill::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields(), 'reference' => Reference::getSerializer()->getFields(), 'lineage' => Lineage::getSerializer()->getFields(), 'picture' => Picture::getSerializer()->getFields(), 'video' => Video::getSerializer()->getFields(), 'kstruktur' => Kstruktur::getSerializer()->getFields(), 'function-phase' => FunctionPhase::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
if ($params->getPage('size') != -1) {
$document->setMeta(['total' => $data->getNbResults(), 'first' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getFirstPage()]]), 'next' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getNextPage()]]), 'previous' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getPreviousPage()]]), 'last' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getLastPage()]])]);
}
// return response
return new JsonResponse($document->toArray());
}
示例5: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = Sport::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['objects', 'positions', 'skills', 'groups', 'skills.groups', 'skills.objects', 'skills.start-position', 'skills.end-position', 'skills.variationOf', 'skills.parents', 'skills.lineages', 'skills.lineages.ancestor', 'skills.lineages.skill', 'skills.featured-picture']));
$resource = $resource->fields($params->getFields(['sport' => Sport::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'position' => Position::getSerializer()->getFields(), 'skill' => Skill::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
if ($params->getPage('size') != -1) {
$document->setMeta(['total' => $data->getNbResults(), 'first' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getFirstPage()]]), 'next' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getNextPage()]]), 'previous' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getPreviousPage()]]), 'last' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getLastPage()]])]);
}
// return response
return new JsonResponse($document->toArray());
}
示例6: found
/**
* @param Request $request
* @param Found $payload
*/
public function found(Request $request, Found $payload)
{
$params = new Parameters($request->query->all());
$data = $payload->getModel();
$serializer = Localization::getSerializer();
$resource = new Collection($data, $serializer);
$resource = $resource->with($params->getInclude(['localizations', 'parent', 'language', 'ext-lang', 'script', 'language-variants', 'application-uris']));
$resource = $resource->fields($params->getFields(['localization' => Localization::getSerializer()->getFields(), 'parent' => Localization::getSerializer()->getFields(), 'language' => Language::getSerializer()->getFields(), 'ext-lang' => Language::getSerializer()->getFields(), 'script' => LanguageScript::getSerializer()->getFields(), 'language-variant' => LanguageVariant::getSerializer()->getFields(), 'application-uri' => ApplicationUri::getSerializer()->getFields()]));
$document = new Document($resource);
// meta
if ($params->getPage('size') != -1) {
$document->setMeta(['total' => $data->getNbResults(), 'first' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getFirstPage()]]), 'next' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getNextPage()]]), 'previous' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getPreviousPage()]]), 'last' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getLastPage()]])]);
}
// return response
return new JsonResponse($document->toArray());
}