public function checkValid() { parent::checkValid(); if (empty($this->sTableName)) { throw new Exception("Table name is required"); } if (count($this->getFieldsCount()) < 1) { throw new Exception("Fields are required"); } if (!FlexiStringUtil::isCleanName($this->sTableName)) { throw new Exception("Invalid value for table name"); } $aFields =& $this->aChild["field"]; foreach ($aFields as $sName => $oField) { //only check active, none deleted only if ($oField->iStatus == 1) { if ($oField->dbtype == "text") { if (!empty($oField->default) && strtolower($oField->default) != "null") { throw new Exception($sName . ": DbType text cannot have default value"); } } if (!$oField->cannull && strtolower($oField->default) == "null") { throw new Exception($sName . ": Default value null on a not null-able field"); } } } }
public function checkValid() { if (empty($this->sName)) { throw new Exception("Name is required"); } if (empty($this->iVersion)) { throw new Exception("Version is required"); } if (!FlexiStringUtil::isCleanName($this->sName)) { throw new Exception("Invalid value for name"); } }