* added a getDefinition for columns and indexes - I am not very sure it's a very...
[vsc.git] / _res / _libs / models / foo / fields / foofieldinteger.class.php
blob375c2a162acde79ef56a7b4926cbb42bd56dc693
1 <?php
2 /**
3 * @package ts_models
4 * @author Marius Orcsik <marius@habarnam.ro>
5 * @date 09.03.29
6 */
7 class fooFieldInteger extends fooFieldA {
8 const TYPE = 'integer';
9 protected $maxLength = 11;
10 protected $autoIncrement = false;
12 public function isInt (fooFieldA $oField) {
13 return ($oField instanceof self);
16 public function getType () {
17 return self::TYPE;
20 protected function escape () {
21 return (int) $this->value;
24 /**
25 * @param bool $bIsAutoIncrement
26 * @return void
28 public function setAutoIncrement ($bIsAutoIncrement) {
29 $this->autoIncrement = (bool)$bIsAutoIncrement;
32 public function getAutoIncrement () {
33 return $this->autoIncrement;
36 public function getDefinition () {
37 // this is totally wrong for PostgreSQL
38 return $this->getType() .
39 ($this->getMaxLength() ? '(' . $this->getMaxLength() . ')' : '') .
40 ($this->getIsNullable() ? ' NULL' : ' NOT NULL') .
41 ($this->getAutoIncrement() ? ' AUTO_INCREMENT' : '');