Children will change id_parent and references in the same database will be updated The config will remain the one from the destination
function($src, $dest)
{
if ($this->check()) {
$o_src = $this->option($src);
$o_dest = $this->option($dest);
$num = 0;
$cf =& $this->fields;
if ($o_dest && $o_src) {
$o_final = X::mergeArrays($o_src, $o_dest);
// Order remains the dest one
$o_final[$cf['num']] = $o_dest[$cf['num']];
$tables = $this->db->getForeignKeys($cf['id'], $this->class_cfg['table']);
foreach ($tables as $table => $cols){
foreach ($cols as $c){
$num += (int)$this->db->update($table, [$c => $dest], [$c => $src]);
}
}
if ($opt = $this->options($src)) {
// Moving children
foreach ($opt as $id => $text){
$num += (int)$this->move($id, $dest);
}
}
$num += (int)$this->set($dest, $o_final);
$num += (int)$this->remove($src);
$this->deleteCache($o_final[$cf['id_parent']], true);
$this->deleteCache($o_src[$cf['id_parent']], true);
if ($this->isSortable($o_src[$cf['id_parent']])) {
$this->fixOrder($o_src[$cf['id_parent']]);
}
if ($this->isSortable($o_final[$cf['id_parent']])) {
$this->fixOrder($o_final[$cf['id_parent']]);
}
}
return $num;
}
return null;
}