本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}