当前位置: 首页>>代码示例>>PHP>>正文


PHP ColumnMap::getType方法代码示例

本文整理汇总了PHP中ColumnMap::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP ColumnMap::getType方法的具体用法?PHP ColumnMap::getType怎么用?PHP ColumnMap::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColumnMap的用法示例。


在下文中一共展示了ColumnMap::getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convertValueForColumn

 /**
  * Converts value for some column types
  *
  * @param  mixed     $value  The value to convert
  * @param  ColumnMap $colMap The ColumnMap object
  * @return mixed     The converted value
  */
 protected function convertValueForColumn($value, ColumnMap $colMap)
 {
     if ($colMap->getType() == 'OBJECT' && is_object($value)) {
         if (is_array($value)) {
             $value = array_map('serialize', $value);
         } else {
             $value = serialize($value);
         }
     } elseif ($colMap->getType() == 'ARRAY' && is_array($value)) {
         $value = '| ' . implode(' | ', $value) . ' |';
     } elseif ($colMap->getType() == 'ENUM') {
         if (is_array($value)) {
             $value = array_map(array($colMap, 'getValueSetKey'), $value);
         } else {
             $value = $colMap->getValueSetKey($value);
         }
     }
     return $value;
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:26,代码来源:ModelCriteria.php

示例2: getValidatorClassForColumn

 /**
  * Returns a sfValidator class name for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The name of a subclass of sfValidator
  */
 public function getValidatorClassForColumn(ColumnMap $column)
 {
     switch ($column->getType()) {
         case PropelColumnTypes::BOOLEAN:
             $name = 'Boolean';
             break;
         case PropelColumnTypes::CLOB:
         case PropelColumnTypes::CHAR:
         case PropelColumnTypes::VARCHAR:
         case PropelColumnTypes::LONGVARCHAR:
             $name = 'String';
             break;
         case PropelColumnTypes::DOUBLE:
         case PropelColumnTypes::FLOAT:
         case PropelColumnTypes::NUMERIC:
         case PropelColumnTypes::DECIMAL:
         case PropelColumnTypes::REAL:
             $name = 'Number';
             break;
         case PropelColumnTypes::INTEGER:
         case PropelColumnTypes::SMALLINT:
         case PropelColumnTypes::TINYINT:
         case PropelColumnTypes::BIGINT:
             $name = 'Integer';
             break;
         case PropelColumnTypes::DATE:
             $name = 'Date';
             break;
         case PropelColumnTypes::TIME:
             $name = 'Time';
             break;
         case PropelColumnTypes::TIMESTAMP:
             $name = 'DateTime';
             break;
         default:
             $name = 'Pass';
     }
     if ($column->isPrimaryKey() || $column->isForeignKey()) {
         $name = 'PropelChoice';
     }
     return sprintf('sfValidator%s', $name);
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:49,代码来源:sfPropelFormGenerator.class.php

示例3: getType

 public function getType(ColumnMap $column)
 {
     if ($column->isForeignKey()) {
         return 'ForeignKey';
     }
     switch ($column->getType()) {
         case PropelColumnTypes::BOOLEAN:
             return 'Boolean';
         case PropelColumnTypes::DATE:
         case PropelColumnTypes::TIME:
         case PropelColumnTypes::TIMESTAMP:
             return 'Date';
         case PropelColumnTypes::DOUBLE:
         case PropelColumnTypes::FLOAT:
         case PropelColumnTypes::NUMERIC:
         case PropelColumnTypes::DECIMAL:
         case PropelColumnTypes::REAL:
         case PropelColumnTypes::INTEGER:
         case PropelColumnTypes::SMALLINT:
         case PropelColumnTypes::TINYINT:
         case PropelColumnTypes::BIGINT:
             return 'Number';
         default:
             return 'Text';
     }
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:26,代码来源:sfPropelFormFilterGenerator.class.php

示例4: 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()}();
     }
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:23,代码来源:DatabaseHelper.php

示例5: formatTemporalValue

 /**
  * Formats a temporal value brefore binding, given a ColumnMap object
  *
  * @param     mixed      $value  The temporal value
  * @param     ColumnMap  $cMap
  *
  * @return    string  The formatted temporal value
  */
 protected function formatTemporalValue($value, ColumnMap $cMap)
 {
     /** @var $dt PropelDateTime */
     if ($dt = PropelDateTime::newInstance($value)) {
         switch ($cMap->getType()) {
             case PropelColumnTypes::TIMESTAMP:
             case PropelColumnTypes::BU_TIMESTAMP:
                 $value = $dt->format($this->getTimestampFormatter());
                 break;
             case PropelColumnTypes::DATE:
             case PropelColumnTypes::BU_DATE:
                 $value = $dt->format($this->getDateFormatter());
                 break;
             case PropelColumnTypes::TIME:
                 $value = $dt->format($this->getTimeFormatter());
                 break;
         }
     }
     return $value;
 }
开发者ID:homer6,项目名称:Propel,代码行数:28,代码来源:DBAdapter.php

示例6: _getColumnRawValue

 protected static function _getColumnRawValue(ColumnMap $column, $value)
 {
     if ($value === null) {
         return null;
     }
     switch ($column->getType()) {
         case PropelColumnTypes::ENUM:
             $valueSet = $column->getValueSet();
             return array_search($value, $valueSet);
         case PropelColumnTypes::PHP_ARRAY:
             return '| ' . implode(' | ', $value) . ' |';
         case PropelColumnTypes::OBJECT:
             return serialize($value);
     }
     return $value;
 }
开发者ID:varvanin,项目名称:currycms,代码行数:16,代码来源:Propel.php

示例7: 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);
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:20,代码来源:ModelForm.php

示例8: 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);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:20,代码来源:ncPropelChangeLogBehavior.class.php


注:本文中的ColumnMap::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。