Skip to content

Commit

Permalink
Fix problem with isset
Browse files Browse the repository at this point in the history
  • Loading branch information
bmidget committed Oct 12, 2013
1 parent fc9314a commit 32aa18f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion classes/Formo/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function get_form( array $fields, Formo $form = NULL)
}
}

if ( ! isset($this->$field_name))
if ($this->_field_exists($field_name) !== TRUE)
{
// Custom method looks like _formo_$field_name()
$method = '_formo_'.$field_name;
Expand Down Expand Up @@ -234,6 +234,15 @@ protected static function _get_field_name( ORM $model)
return $field_name;
}

protected function _field_exists($column)
{
return (array_key_exists($column, $this->_object) OR
array_key_exists($column, $this->_related) OR
array_key_exists($column, $this->_has_one) OR
array_key_exists($column, $this->_belongs_to) OR
array_key_exists($column, $this->_has_many));
}

/**
* Fills $this->_foreign_keys in order to easier
* find foreign keys in all the process_type methods
Expand Down

0 comments on commit 32aa18f

Please sign in to comment.