<?php
if (!empty($regid) && $current_path == '/registration/add') {
$response = new RedirectResponse(Url::fromRoute('entity.registration.edit_form', ['registration' => $regid])->toString());
$response->send();
}
<?php
$q = $db->select('_pricelist', 'pr');
$q->fields('pr');
//$q->condition('cs.combination', $programme);
$r = $q->execute();
$type = '';
foreach ($r as $k=>$v) {
if ($type != $v->type) {
$items[$v->type] = $v->type;
}
else {
$items[$v->type] = $db->query("select (id-1),`name` from `_pricelist` where type = '$v->type' order by `name`")->fetchAllKeyed();
}
$type = $v->type;
}