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


PHP Document::toArray方法代码示例

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


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

示例1: found

 protected function found(Request $request, Found $payload)
 {
     $serializer = new AuthSessionSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:keeko,项目名称:auth,代码行数:7,代码来源:StatusJsonResponder.php

示例2: testToArrayIncludesTheResourcesRepresentation

 public function testToArrayIncludesTheResourcesRepresentation()
 {
     $post = (object) ['id' => 1, 'foo' => 'bar'];
     $resource = new Resource($post, new PostSerializer2());
     $document = new Document($resource);
     $this->assertEquals(['data' => $resource->toArray()], $document->toArray());
 }
开发者ID:ahsanity,项目名称:json-api,代码行数:7,代码来源:DocumentTest.php

示例3: success

 protected function success(Request $request, Success $payload)
 {
     $serializer = new AuthSessionSerializer();
     $resource = new Resource($payload->get('session'), $serializer);
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 201);
 }
开发者ID:keeko,项目名称:auth,代码行数:7,代码来源:LoginJsonResponder.php

示例4: testToArrayIncludesTheResourcesRepresentation

 public function testToArrayIncludesTheResourcesRepresentation()
 {
     $resource = new Resource('post', 1);
     $document = new Document();
     $document->setData($resource);
     $this->assertEquals(['data' => $resource->toArray()], $document->toArray());
 }
开发者ID:redstarxz,项目名称:flarumone,代码行数:7,代码来源:DocumentTest.php

示例5: created

 /**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = PerformanceStatistic::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 201, ['Location' => $resource->getLinks()['self']]);
 }
开发者ID:iuf,项目名称:junia,代码行数:11,代码来源:PerformanceStatisticCreateJsonResponder.php

示例6: toArray

 public function toArray()
 {
     // We resolve the root element
     if ($this->data instanceof ElementPromise && null !== ($promise = $this->data->getPromise())) {
         $promise->wait();
     }
     return parent::toArray();
 }
开发者ID:guillemcanal,项目名称:api-gateway,代码行数:8,代码来源:Document.php

示例7: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Judge::getSerializer();
     $resource = new Resource($payload->getModel(), $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);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:iuf,项目名称:junia,代码行数:14,代码来源:JudgeReadJsonResponder.php

示例8: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = RegionType::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['countries', 'subdivisions', 'area']));
     $resource = $resource->fields($params->getFields(['region-type' => RegionType::getSerializer()->getFields(), 'country' => Country::getSerializer()->getFields(), 'subdivision' => Subdivision::getSerializer()->getFields(), 'area' => RegionArea::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:keeko,项目名称:core,代码行数:14,代码来源:RegionTypeReadJsonResponder.php

示例9: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Object::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sport', 'skills', 'skills.variations', 'skills.variationOf', 'skills.multiples', 'sport.objects']));
     $resource = $resource->fields($params->getFields(['object' => Object::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'skill' => Skill::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:gossi,项目名称:trixionary,代码行数:14,代码来源:ObjectReadJsonResponder.php

示例10: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = FunctionPhase::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['root-skills', 'skill']));
     $resource = $resource->fields($params->getFields(['function-phase' => FunctionPhase::getSerializer()->getFields(), 'root-skill' => Skill::getSerializer()->getFields(), 'skill' => Skill::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:gossi,项目名称:trixionary,代码行数:14,代码来源:FunctionPhaseReadJsonResponder.php

示例11: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Competition::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['startgroups']));
     $resource = $resource->fields($params->getFields(['competition' => Competition::getSerializer()->getFields(), 'startgroup' => Startgroup::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:iuf,项目名称:junia,代码行数:14,代码来源:CompetitionReadJsonResponder.php

示例12: updated

 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Localization::getSerializer();
     $resource = new Resource($payload->getModel(), $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);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:keeko,项目名称:core,代码行数:14,代码来源:LocalizationUpdateJsonResponder.php

示例13: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = PerformanceStatistic::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['events', 'startgroups', 'routine']));
     $resource = $resource->fields($params->getFields(['performance-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'startgroup' => Startgroup::getSerializer()->getFields(), 'routine' => Routine::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:iuf,项目名称:junia,代码行数:14,代码来源:PerformanceStatisticReadJsonResponder.php

示例14: updated

 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = User::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sessions', 'groups', 'activities']));
     $resource = $resource->fields($params->getFields(['user' => User::getSerializer()->getFields(), 'session' => Session::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields(), 'activity' => Activity::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:keeko,项目名称:core,代码行数:14,代码来源:UserUpdateJsonResponder.php

示例15: found

 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Action::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['module', 'groups', 'apis']));
     $resource = $resource->fields($params->getFields(['action' => Action::getSerializer()->getFields(), 'module' => Module::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields(), 'api' => Api::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
开发者ID:keeko,项目名称:core,代码行数:14,代码来源:ActionReadJsonResponder.php


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