method getLastVersionCfg documentation in bbn\Appui\Note
Returns the configuration to have the last version for each note
function($with_content = false)
{
$cf = &$this->class_cfg;
$res = [
'tables' => [$cf['table']],
'fields' => [
'versions.' . $cf['arch']['versions']['id_note'],
$cf['arch']['notes']['id_type'],
$cf['arch']['notes']['id_option'],
'versions.' . $cf['arch']['versions']['version'],
'versions.' . $cf['arch']['versions']['excerpt'],
'versions.' . $cf['arch']['versions']['title'],
'versions.' . $cf['arch']['versions']['id_user'],
'versions.' . $cf['arch']['versions']['creation'],
'num_translations' => "COUNT(aliases.id)",
'num_variants' => "COUNT(parents.id)",
'versions.' . $cf['arch']['versions']['content']
],
'join' => [[
'table' => $cf['tables']['versions'],
'alias' => 'versions',
'on' => [
'conditions' => [[
'field' => $this->db->cfn($cf['arch']['notes']['id'], $cf['table']),
'exp' => 'versions.' . $cf['arch']['versions']['id_note'],
], [
'field' => 'versions.' . $cf['arch']['versions']['latest'],
'value' => 1
]],
],
], [
'table' => $cf['tables']['notes'],
'alias' => 'parents',
'type' => 'left',
'on' => [
'conditions' => [[
'field' => $this->db->cfn($cf['arch']['notes']['id'], $cf['table']),
'exp' => 'parents.' . $cf['arch']['notes']['id_parent'],
]],
],
], [
'table' => $cf['tables']['notes'],
'alias' => 'aliases',
'type' => 'left',
'on' => [
'conditions' => [[
'field' => $this->db->cfn($cf['arch']['notes']['id'], $cf['table']),
'exp' => 'aliases.' . $cf['arch']['notes']['id_alias'],
]],
],
]],
'where' => [
'logic' => 'AND',
'conditions' => [
]
],
'group_by' => $this->db->cfn($cf['arch']['notes']['id'], $cf['table'])
];
if (!$with_content) {
array_pop($res['fields']);
}
return $res;
}
Returns the configuration to have the last version for each note 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-2023
BBN Solutions