protected static function _process_has_many($alias, Kohana_ORM $model, stdClass $std, Formo $form) { if (empty($std->has_many)) { // No need to process non-has-many fields here return NULL; } foreach (Arr::get($std->has_many, 'definitions', array()) as $key => $values) { if (Arr::get($values, 'formo') === true) { $rs_all = ORM::factory($values['model'])->find_all(); $foreign_model = ORM::factory($values['model']); $rs_in = $foreign_model->where($values['foreign_key'], '=', $model->pk())->find_all(); $opts = static::select_list($rs_all, $foreign_model->primary_key(), static::_get_field_name($foreign_model)); $val = static::select_list($rs_in, $foreign_model->primary_key(), $foreign_model->primary_key()); $form->add($key, 'checkboxes', $val, array('opts' => $opts)); } else { $form->add($key, 'checkboxes', null, array('render' => false)); } } }