From 951cf3bab65f8b24375059453bff2432ebd8f959 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Thu, 4 Jul 2013 18:44:54 +0300 Subject: [PATCH] more checks --- ipf/form/model.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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)); } } } -- 2.49.0