diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 1f53e91..c8429da 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -177,7 +177,7 @@ class Controller_Component public function setParameters(/*.View_Composite.*/$view) { $form = new Form_Form(); - $options = new OptionFactory($this->db); + $options = new OptionFactory($this->db, $this->registry); $settings = $this->getInfo(); $form->addFieldList($settings['parameter'], $options); diff --git a/src/Form/Form.php b/src/Form/Form.php index f79c9f3..458e8fa 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -190,9 +190,10 @@ class TDateTime extends TInput { class OptionFactory { public $db; - - function __construct($db) { + public $registry; + function __construct($db, $registry = null) { $this->db = $db; + $this->registry = $registry; } function create(TSelect $field, $input) { @@ -225,6 +226,10 @@ class OptionFactory { $field->options = $this->optionsDB($key, $value, $query_result); } elseif (isset($input['options.pair'])) { $field->options = $this->optionsPair($input['options.pair']); + } elseif (isset($input['options.model'])) { + $factory = new Model_Factory($this->db, $this->registry); + $model = $factory->getModel($input['options.model']); + $field->options = $model->getAllAsOptions(); } else { $field->options = $input['options']; }