本文整理汇总了PHP中ColumnMap::getPhpName方法的典型用法代码示例。如果您正苦于以下问题:PHP ColumnMap::getPhpName方法的具体用法?PHP ColumnMap::getPhpName怎么用?PHP ColumnMap::getPhpName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColumnMap
的用法示例。
在下文中一共展示了ColumnMap::getPhpName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setColumnValue
/**
* Set column value from instance.
*
* @param \BaseObject $instance
* @param \ColumnMap $column
* @param mixed $value
*/
protected function setColumnValue(\BaseObject $instance, \ColumnMap $column, $value)
{
if ($column->getType() === \PropelColumnTypes::PHP_ARRAY && !is_array($value)) {
if (is_string($value) && !empty($value)) {
$value = explode("\n", $value);
} else {
if ($value !== null) {
$value = array();
}
}
}
$instance->{'set' . $column->getPhpName()}($value);
}
示例2: getColumnValue
/**
* Get value for column to use in database dump.
*
* @param BaseObject $obj
* @param ColumnMap $column
* @return mixed
*/
protected static function getColumnValue(BaseObject $obj, ColumnMap $column)
{
switch ($column->getType()) {
case PropelColumnTypes::DATE:
return $obj->{'get' . $column->getPhpName()}('Y-m-d');
break;
case PropelColumnTypes::TIMESTAMP:
return $obj->{'get' . $column->getPhpName()}('Y-m-d H:i:s');
break;
case PropelColumnTypes::TIME:
return $obj->{'get' . $column->getPhpName()}('H:i:s');
break;
default:
return $obj->{'get' . $column->getPhpName()}();
}
}
示例3: extractValueMethod
/**
* Extract the value method and the required parameters for it, for given a ColumnMap's type.
* Return an Array holding the value method as first value and its parameters as the second one.
*
* @param ColumnMap $column
* @return Array
*/
public static function extractValueMethod(ColumnMap $column)
{
$value_method = 'get' . $column->getPhpName();
$params = null;
if (in_array($column->getType(), array(PropelColumnTypes::BU_DATE, PropelColumnTypes::DATE))) {
$params = ncChangeLogConfigHandler::getDateFormat();
} elseif (in_array($column->getType(), array(PropelColumnTypes::BU_TIMESTAMP, PropelColumnTypes::TIMESTAMP))) {
$params = ncChangeLogConfigHandler::getDateTimeFormat();
} elseif ($column->getType() == PropelColumnTypes::TIME) {
$params = ncChangeLogConfigHandler::getTimeFormat();
}
return array($value_method, $params);
}