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


PHP Manager::getSerializer方法代码示例

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


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

示例1: fireTransformer

 /**
  * Fire the main transformer.
  *
  * @internal
  *
  * @param TransformerAbstract|callable $transformer
  * @param mixed                        $data
  *
  * @return array
  */
 protected function fireTransformer($transformer, $data)
 {
     $includedData = array();
     if (is_callable($transformer)) {
         $transformedData = call_user_func($transformer, $data);
     } else {
         $transformedData = $transformer->transform($data);
     }
     if ($this->transformerHasIncludes($transformer)) {
         $includedData = $this->fireIncludedTransformers($transformer, $data);
         $transformedData = $this->manager->getSerializer()->mergeIncludes($transformedData, $includedData);
     }
     return array($transformedData, $includedData);
 }
开发者ID:r3jack,项目名称:fractal,代码行数:24,代码来源:Scope.php

示例2: fireTransformer

 /**
  * Fire the main transformer.
  *
  * @internal
  *
  * @param TransformerAbstract|callable $transformer
  * @param mixed                        $data
  *
  * @return array
  */
 protected function fireTransformer($transformer, $data)
 {
     $includedData = array();
     if (is_callable($transformer)) {
         $transformedData = call_user_func($transformer, $data);
     } else {
         $transformedData = $transformer->transform($data);
     }
     if ($this->transformerHasIncludes($transformer)) {
         $includedData = $this->fireIncludedTransformers($transformer, $data);
         // If the serializer does not want the includes to be side-loaded then
         // the included data must be merged with the transformed data.
         if (!$this->manager->getSerializer()->sideloadIncludes()) {
             $transformedData = array_merge($transformedData, $includedData);
         }
     }
     return array($transformedData, $includedData);
 }
开发者ID:petrovitch,项目名称:smoothing,代码行数:28,代码来源:Scope.php

示例3: getResourceKey

 /**
  * Calculate the resourceKey.
  * If configured serializer is not an instance of JsonApiSerializer
  * the resourceKey is useless and null will be returned
  *
  * @param string $resourceKey
  * @return string|null
  */
 private function getResourceKey($resourceKey)
 {
     return $this->fractal->getSerializer() instanceof JsonApiSerializer ? $resourceKey : null;
 }
开发者ID:appkr,项目名称:fractal,代码行数:12,代码来源:Response.php


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