當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。