當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ViewableData::castingHelper方法代碼示例

本文整理匯總了PHP中ViewableData::castingHelper方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewableData::castingHelper方法的具體用法?PHP ViewableData::castingHelper怎麽用?PHP ViewableData::castingHelper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ViewableData的用法示例。


在下文中一共展示了ViewableData::castingHelper方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: castingHelper

 /**
  * Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
  * on this object.
  *
  * @param string $field
  * @return string Casting helper
  */
 public function castingHelper($field)
 {
     $specs = $this->config()->casting;
     if (isset($specs[$field])) {
         return $specs[$field];
     } elseif ($this->failover) {
         return $this->failover->castingHelper($field);
     }
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:16,代碼來源:ViewableData.php

示例2: castingHelper

 /**
  * @param  string $field
  * @return string|null
  */
 public function castingHelper($field)
 {
     $castings = $this->obj->getCastings();
     if (isset($castings[$field])) {
         return $castings[$field];
     } else {
         return parent::castingHelper($field);
     }
 }
開發者ID:helpfulrobot,項目名稱:heystack-heystack,代碼行數:13,代碼來源:ViewableDataFormatter.php

示例3: castingHelper

	/**
	 * Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
	 * on this object.
	 *
	 * @param string $field
	 * @return string
	 */
	public function castingHelper($field) {
		if($this->hasMethod('db') && $fieldSpec = $this->db($field)) {
			return $fieldSpec;
		}

		$specs = Config::inst()->get(get_class($this), 'casting');
		if(isset($specs[$field])) return $specs[$field];

		if($this->failover) return $this->failover->castingHelper($field);
	}
開發者ID:redema,項目名稱:sapphire,代碼行數:17,代碼來源:ViewableData.php

示例4: castingHelper

    /**
     * Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
     * on this object.
     *
     * @param string $field
     * @return string
     */
    public function castingHelper($field)
    {
        if ($this->hasMethod('db') && ($fieldSpec = $this->db($field))) {
            Deprecation::notice('4.0', 'ViewableData::castingHelper() will no longer extract casting information "db". Please override
				castingHelper in your ViewableData subclass.', Deprecation::SCOPE_GLOBAL);
            return $fieldSpec;
        }
        $specs = Config::inst()->get(get_class($this), 'casting');
        if (isset($specs[$field])) {
            return $specs[$field];
        }
        if ($this->failover) {
            return $this->failover->castingHelper($field);
        }
    }
開發者ID:aaronleslie,項目名稱:aaronunix,代碼行數:22,代碼來源:ViewableData.php

示例5: castingHelper

 public function castingHelper($field)
 {
     // Allows db to act as implicit casting override
     if ($fieldSpec = $this->db($field)) {
         return $fieldSpec;
     }
     return parent::castingHelper($field);
 }
開發者ID:jman48,項目名稱:silverstripe-framework,代碼行數:8,代碼來源:DataObject.php

示例6: castingHelper

 /**
  * {@inheritdoc}
  */
 public function castingHelper($field)
 {
     if ($fieldSpec = $this->db($field)) {
         return $fieldSpec;
     }
     // many_many_extraFields aren't presented by db(), so we check if the source query params
     // provide us with meta-data for a many_many relation we can inspect for extra fields.
     $queryParams = $this->getSourceQueryParams();
     if (!empty($queryParams['Component.ExtraFields'])) {
         $extraFields = $queryParams['Component.ExtraFields'];
         if (isset($extraFields[$field])) {
             return $extraFields[$field];
         }
     }
     return parent::castingHelper($field);
 }
開發者ID:aaronleslie,項目名稱:aaronunix,代碼行數:19,代碼來源:DataObject.php


注:本文中的ViewableData::castingHelper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。