/** * * @param string $metadata_type * @return AbstractType */ public static function getColumnTypeByMetadataType($metadata_type) { if (!array_key_exists($metadata_type, self::$mapper)) { $mt = (string) $metadata_type; throw new Exception\InvalidArgumentException(__METHOD__ . " Cannot map the metadata type '{$mt}' to a column model type"); } return ColumnType::createType(self::$mapper[$metadata_type]); }
/** * Set column datatype * @param string|AbstractType $type * @throws Exception\InvalidArgumentException when the type is not supported. * @return Column */ public function setType($type) { if (is_string($type)) { $type = ColumnType::createType($type); } elseif (!$type instanceof AbstractType) { throw new Exception\InvalidArgumentException(__METHOD__ . " setType() accepts only AbstractType or string."); } $this->properties['type'] = $type; return $this; }