当前位置: 首页>>代码示例>>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;未经允许,请勿转载。