コード例 #1
0
ファイル: SqliteDataTypeMapper.php プロジェクト: sigma-z/dive
 /**
  * constructor
  *
  * @param array $mapping
  * @param array $ormTypeMapping
  */
 public function __construct(array $mapping = array(), array $ormTypeMapping = array())
 {
     $defaultDataTypeMapping = array('boolean' => self::OTYPE_BOOLEAN, 'int' => self::OTYPE_INTEGER, 'integer' => self::OTYPE_INTEGER, 'tinyint' => self::OTYPE_INTEGER, 'smallint' => self::OTYPE_INTEGER, 'mediumint' => self::OTYPE_INTEGER, 'bigint' => self::OTYPE_INTEGER, 'double' => self::OTYPE_DECIMAL, 'float' => self::OTYPE_DECIMAL, 'real' => self::OTYPE_DECIMAL, 'decimal' => self::OTYPE_DECIMAL, 'numeric' => self::OTYPE_DECIMAL, 'character' => self::OTYPE_STRING, 'varchar' => self::OTYPE_STRING, 'text' => self::OTYPE_STRING, 'date' => self::OTYPE_DATE, 'datetime' => self::OTYPE_DATETIME, 'time' => self::OTYPE_TIME, 'timestamp' => self::OTYPE_TIMESTAMP, 'blob' => self::OTYPE_BLOB);
     $defaultOrmTypeMapping = array(self::OTYPE_INTEGER => array('default' => 'integer', 'unit' => self::UNIT_BYTES, 'types' => array('tinyint' => 1, 'smallint' => 2, 'mediumint' => 3, 'integer' => 4, 'int' => 4, 'bigint' => 8)), self::OTYPE_STRING => array('default' => 'text', 'unit' => self::UNIT_CHARS, 'types' => array('varchar' => 255)), self::OTYPE_TIME => 'character', self::OTYPE_ENUM => 'varchar');
     $mapping = array_merge($defaultDataTypeMapping, $mapping);
     $ormTypeMapping = array_merge($defaultOrmTypeMapping, $ormTypeMapping);
     parent::__construct($mapping, $ormTypeMapping);
 }
コード例 #2
0
 /**
  * Gets the datatype of this attribute
  */
 function getDatatype()
 {
     if ($this->datatype == null) {
         $datatypeMapper = new DataTypeMapper();
         $this->datatype = $datatypeMapper->get($this->getDatatypeId());
     }
     return $this->datatype;
 }