# FloatType.class.php

Go to the documentation of this file.

    00001 <?php
    00002 /***************************************************************************
    00003  *   Copyright (C) 2006-2007 by Nickolay G. Korolyov                       *
    00004  *                                                                         *
    00005  *   This program is free software; you can redistribute it and/or modify  *
    00006  *   it under the terms of the GNU Lesser General Public License as        *
    00007  *   published by the Free Software Foundation; either version 3 of the    *
    00008  *   License, or (at your option) any later version.                       *
    00009  *                                                                         *
    00010  ***************************************************************************/
    00011
    00015     class FloatType extends IntegerType
    00016     {
    00017         protected $precision = 0;
    00018
    00019         public function getPrimitiveName()
    00020         {
    00021             return 'float';
    00022         }
    00023
    00028         public function setDefault($default)
    00029         {
    00030             Assert::isFloat(
    00031                 $default,
    00032                 "strange default value given - '{$default}'"
    00033             );
    00034
    00035             $this->default = $default;
    00036
    00037             return $this;
    00038         }
    00039
    00043         public function setPrecision($precision)
    00044         {
    00045             $this->precision = $precision;
    00046
    00047             return $this;
    00048         }
    00049
    00050         public function getPrecision()
    00051         {
    00052             return $this->precision;
    00053         }
    00054
    00055         public function isMeasurable()
    00056         {
    00057             return true;
    00058         }
    00059
    00060         public function toColumnType()
    00061         {
    00062             return 'DataType::create(DataType::REAL)';
    00063         }
    00064     }
    00065 ?>