Merge branch 'dev' of http://gitlab.edu.yar.ru/composer/PHP_Library into dev
This commit is contained in:
commit
e179b580eb
2 changed files with 8 additions and 3 deletions
|
|
@ -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'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue