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


PHP Resource::getData方法代码示例

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


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

示例1: getComposite

 public function getComposite()
 {
     $composerName = $this->resource->getComposer();
     $composer = $this->composerManager->getComposer($composerName);
     $data = is_object($this->resource->getData()) ? array($this->resource->getData()) : $this->resource->getData();
     // Get embeded composed models
     $embededModels = $composer->getEmbededModels($this, $data);
     // Compose resource
     $embededModels = $embededModels ? $embededModels : array();
     return $composer->compose($data, $embededModels);
 }
开发者ID:evaneos,项目名称:berthe,代码行数:11,代码来源:Scope.php

示例2: testGetData

 public function testGetData()
 {
     $resource = new Resource();
     $resource->addSuccessMessage('foo');
     $resource->addInfoMessage('bar');
     $resource->addWarningMessage('baz');
     $resource->addErrorMessage('boom');
     $resource->setData(['key' => 'value']);
     $this->assertSame(['key' => 'value', '_messages' => [['type' => 'success', 'message' => 'foo'], ['type' => 'info', 'message' => 'bar'], ['type' => 'warn', 'message' => 'baz'], ['type' => 'error', 'message' => 'boom']]], $resource->getData());
 }
开发者ID:asylgrp,项目名称:workbench,代码行数:10,代码来源:ResourceTest.php

示例3: getFilteredAttributes

 /**
  * Filter attributes. Applies the visible/hidden field filter, hides owner of resource.
  * If visible attributes are defined, hidden attributes filter will not be applied.
  *
  * @param \marius321967\BaseResource\Resource $resource
  * @return array
  */
 public static function getFilteredAttributes(Resource $resource)
 {
     $descriptor = $resource->getDescriptor();
     $attributes = $resource->getData(true);
     // In whatever case, client does not need to know about the owner of resource.
     unset($attributes['owner_id']);
     // If only fields that are visible are defined, don't use the other filter.
     if (count($descriptor->getVisibleAttributes())) {
         $attributes = array_intersect_key($attributes, array_flip($descriptor->getVisibleAttributes()));
     } elseif (count($descriptor->getHiddenAttributes())) {
         $attributes = array_diff_key($attributes, array_flip($descriptor->getHiddenAttributes()));
     }
     return $attributes;
 }
开发者ID:marius321967,项目名称:lumen-api-resource,代码行数:21,代码来源:AttributeCaster.php


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