method getValuesDesc documentation in bbn\Db\Languages\Sql
Returns a linear array
function(array $where, array $cfg, &$others = [])
{
if (!empty($where['conditions'])) {
foreach ($where['conditions'] as &$f){
// It's an imbricated condition
if (isset($f['logic'], $f['conditions']) && \is_array($f['conditions'])) {
$this->getValuesDesc($f, $cfg, $others);
}
// Value is set
elseif (array_key_exists('value', $f)) {
$desc = [
'primary' => false,
'type' => null,
'maxlength' => null,
'operator' => $f['operator'] ?? null
];
if (isset($cfg['models'], $f['field'], $cfg['available_fields'][$f['field']])) {
$t = $cfg['available_fields'][$f['field']];
if (isset($cfg['models'], $f['field'], $cfg['tables_full'][$t], $cfg['models'][$cfg['tables_full'][$t]])
&& ($model = $cfg['models'][$cfg['tables_full'][$t]])
&& ($fname = $this->colSimpleName($f['field']))
) {
$desc['name'] = $fname;
if (!empty($model['fields'][$fname]['type'])) {
$desc['type'] = $model['fields'][$fname]['type'];
$desc['maxlength'] = $model['fields'][$fname]['maxlength'] ?? null;
$desc['operator'] = $f['operator'] ?? null;
}
// Fixing filters using alias
elseif (isset($cfg['fields'][$f['field']])
&& ($fname = $this->colSimpleName($cfg['fields'][$f['field']]))
&& !empty($model['fields'][$fname]['type'])
) {
$desc['type'] = $model['fields'][$fname]['type'];
$desc['maxlength'] = $model['fields'][$fname]['maxlength'] ?? null;
$desc['operator'] = $f['operator'] ?? null;
}
if (!empty($desc['type'])
&& isset($model['keys']['PRIMARY'])
&& (count($model['keys']['PRIMARY']['columns']) === 1)
&& ($model['keys']['PRIMARY']['columns'][0] === $fname)
) {
$desc['primary'] = true;
}
}
}
$others[] = $desc;
}
}
}
return $others;
}
Returns a linear array BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2024
BBN Solutions