Exemple #1
0
 public function addChild(FlexiObject &$oObject, $sType)
 {
     if (!isset($this->aChild[$sType])) {
         $this->aChild[$sType] = array();
     }
     $sName = $oObject->getName();
     if ($this->existsChild($sName, $sType)) {
         throw new Exception("Child already exists: " . $sName);
     }
     $this->aChild[$sType][$oObject->getName()] =& $oObject;
 }
Exemple #2
0
 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 __construct($sName)
 {
     parent::__construct($sName, "FlexiTableField");
     $this->label = $sName;
 }
Exemple #4
0
 public function createTable(FlexiObject $oObject)
 {
     $sSQL = $oObject->getSchemaSQL();
     $this->logSQL($sSQL);
     return FlexiModelUtil::getInstance()->getXPDOExecute($sSQL);
 }