25 lines
581 B
PHP
25 lines
581 B
PHP
|
<?php
|
||
|
namespace nur\mapper\base;
|
||
|
|
||
|
use nur\A;
|
||
|
use nur\types;
|
||
|
|
||
|
trait Tparams_command {
|
||
|
static function get_def(): array {
|
||
|
return static::DEF;
|
||
|
}
|
||
|
|
||
|
static function get(bool $create=true) {
|
||
|
if (self::$command === null && $create) static::create_command();
|
||
|
return self::$command;
|
||
|
}
|
||
|
|
||
|
static function add_params($params) {
|
||
|
foreach (A::with($params) as $param) {
|
||
|
mapper_utils::split_param($param, $name, $type, $value);
|
||
|
if ($type !== null) $value = types::with($type, $value);
|
||
|
self::$command->setParametrableParams([$name => $value]);
|
||
|
}
|
||
|
}
|
||
|
}
|