protected function __construct(ORM $object, array $fields = array()) { $this->_object = $object; $this->set_name($object->object_name()); $hash = ''; foreach ($fields as $name => $field) { if (!is_array($field)) { $field = array('type' => $field); } $field_cfg = array('name' => $name, 'label' => Arr::get($object->labels(), $name), 'value' => $object[$name]); $field = Arr::merge($field_cfg, (array) $field); $field = Form_Field::factory($field); $field->set_object($object); $this[$name] = $field; $hash .= $field->hash(); } $this->_hash = md5($hash); }