From: Andrey Kutejko Date: Thu, 4 Jul 2013 15:44:54 +0000 (+0300) Subject: more checks X-Git-Tag: 0.5~193 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=951cf3bab65f8b24375059453bff2432ebd8f959;p=ipf.git more checks --- diff --git a/ipf/form/model.php b/ipf/form/model.php index fd7a928..7d14977 100644 --- a/ipf/form/model.php +++ b/ipf/form/model.php @@ -45,17 +45,17 @@ class IPF_Form_Model extends IPF_Form $add_method = 'add__'.$uname.'__field'; if (method_exists($this, $add_method)) { $this->$add_method(); - continue; - } - if (array_key_exists($uname,$db_columns)) { - $this->addDBField($uname,$db_columns[$uname]); - } elseif (array_key_exists($uname,$db_relations)) { + } elseif (array_key_exists($uname, $db_columns)) { + $this->addDBField($uname, $db_columns[$uname]); + } elseif (array_key_exists($uname, $db_relations)) { $lfn = $db_relations[$uname]->getLocalFieldName(); if (isset($db_columns[$lfn])) $col = $db_columns[$lfn]; else $col = array(); - $this->addDBRelation($uname,$db_relations[$uname],$col); + $this->addDBRelation($uname, $db_relations[$uname], $col); + } else { + throw new IPF_Exception_Form(sprintf(__("Model '%s' has no column '%s'."), $this->model->getTable()->getComponentName(), $uname)); } } }