Fixed little bug in padmin and SelectModelForm

This commit is contained in:
Antonio de la Rosa 2015-10-05 04:40:16 +02:00
parent 71081e21c8
commit 31917a339c
2 changed files with 17 additions and 8 deletions

View file

@ -23,15 +23,24 @@ class SelectModelForm extends SelectForm{
public function form()
{
$model->set_conditions($this->conditions);
$query=$model->select(array($this->field_name, $this->field_value), $this->raw_query);
while($row=$model->fetch_array($query))
if($this->field_value=='' || $this->field_name=='')
{
$this->arr_selected[$row[$this->field_value]]=$this->field_name;
throw new \Exception('Need field_value and field_name property');
}
$this->model->set_conditions($this->conditions);
$query=$this->model->select(array($this->field_name, $this->field_value), $this->raw_query);
while($row=$this->model->fetch_array($query))
{
$this->arr_select[$row[$this->field_value]]=$row[$this->field_name];
}