Skip to content
Snippets Groups Projects
Commit bf62a91e authored by Rami Jasim's avatar Rami Jasim Committed by Jan-Hendrik Willms
Browse files

PHP8 TypeError for additional_fields set in SORM

Closes #4761

Merge request studip/studip!3550
parent e5d23219
No related branches found
No related tags found
No related merge requests found
......@@ -1543,7 +1543,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
} else {
$ret = ($this->content[$field] = $value);
}
} elseif (isset($this->additional_fields()[$field]['set'])) {
} elseif (!empty($this->additional_fields()[$field]['set'])) {
if ($this->additional_fields()[$field]['set'] instanceof Closure) {
return call_user_func_array($this->additional_fields()[$field]['set'], [$this, $field, $value]);
} else {
......
......@@ -99,7 +99,6 @@ class Block extends \SimpleORMap implements \PrivacyObject
'get' => function ($block) {
return BlockTypes\BlockType::factory($block);
},
'set' => false,
];
$config['additional_fields']['files'] = [
......@@ -285,6 +284,6 @@ class Block extends \SimpleORMap implements \PrivacyObject
if ($blocks) {
$storage->addTabularData(_('Courseware Blöcke'), 'cw_blocks', $blocks);
}
}
}
......@@ -73,7 +73,6 @@ class Container extends \SimpleORMap implements \PrivacyObject
'get' => function ($container) {
return ContainerTypes\ContainerType::factory($container);
},
'set' => false,
];
parent::configure($config);
......@@ -184,7 +183,7 @@ class Container extends \SimpleORMap implements \PrivacyObject
if ($containers) {
$storage->addTabularData(_('Courseware Abschnitte'), 'cw_containers', $containers);
}
}
public static function createFromData(User $user, $data, StructuralElement $element): Container
......
......@@ -81,11 +81,9 @@ class Task extends \SimpleORMap
$config['additional_fields']['solver'] = [
'get' => 'getSolver',
'set' => false,
];
$config['additional_fields']['submission_date'] = [
'get' => 'getSubmissionDate',
'set' => false,
];
parent::configure($config);
......
......@@ -62,7 +62,6 @@ class DataField extends SimpleORMap implements PrivacyObject
}
return $institution;
},
'set' => false,
);
$config['i18n_fields']['name'] = true;
......
......@@ -71,20 +71,21 @@ class Fach extends ModuleManagementModelTreeItem implements PrivacyObject
'on_delete' => 'delete'
];
$config['additional_fields']['count_abschluesse']['get'] =
function($fach) { return $fach->count_abschluesse; };
$config['additional_fields']['count_abschluesse']['set'] = false;
$config['additional_fields']['count_user']['get'] =
function($fach) { return $fach->count_user; };
$config['additional_fields']['count_user']['set'] = false;
$config['additional_fields']['count_sem']['get'] =
function($fach) { return $fach->count_sem; };
$config['additional_fields']['count_sem']['set'] = false;
$config['additional_fields']['count_stgteile']['get'] =
function($fach) { return $fach->count_stgteile; };
$config['additional_fields']['count_stgteile']['set'] = false;
$config['additional_fields']['count_module']['get'] =
function($fach) { return $fach->count_module; };
$config['additional_fields']['count_abschluesse']['get'] = function ($fach) {
return $fach->count_abschluesse;
};
$config['additional_fields']['count_user']['get'] = function ($fach) {
return $fach->count_user;
};
$config['additional_fields']['count_sem']['get'] = function ($fach) {
return $fach->count_sem;
};
$config['additional_fields']['count_stgteile']['get'] = function ($fach) {
return $fach->count_stgteile;
};
$config['additional_fields']['count_module']['get'] = function ($fach) {
return $fach->count_module;
};
$config['i18n_fields']['name'] = true;
$config['i18n_fields']['name_kurz'] = true;
......
......@@ -55,18 +55,18 @@ class Lvgruppe extends ModuleManagementModelTreeItem
'on_store' => 'store'
];
$config['additional_fields']['count_seminare']['get'] =
function($lvgruppe) { return $lvgruppe->count_seminare; };
$config['additional_fields']['count_seminare']['set'] = false;
$config['additional_fields']['count_archiv']['get'] =
function($lvgruppe) { return $lvgruppe->count_archiv; };
$config['additional_fields']['count_archiv']['set'] = false;
$config['additional_fields']['count_modulteile']['get'] =
function($lvgruppe) { return $lvgruppe->count_modulteile; };
$config['additional_fields']['count_modulteile']['set'] = false;
$config['additional_fields']['count_semester']['get'] =
function($lvgruppe) { return $lvgruppe->count_semester; };
$config['additional_fields']['count_semester']['set'] = false;
$config['additional_fields']['count_seminare']['get'] = function ($lvgruppe) {
return $lvgruppe->count_seminare;
};
$config['additional_fields']['count_archiv']['get'] = function ($lvgruppe) {
return $lvgruppe->count_archiv;
};
$config['additional_fields']['count_modulteile']['get'] = function ($lvgruppe) {
return $lvgruppe->count_modulteile;
};
$config['additional_fields']['count_semester']['get'] = function ($lvgruppe) {
return $lvgruppe->count_semester;
};
$config['i18n_fields']['alttext'] = true;
......
......@@ -140,14 +140,15 @@ class Modul extends ModuleManagementModelTreeItem
'on_store' => 'store'
];
$config['additional_fields']['count_modulteile']['get'] =
function ($modul) { return $modul->count_modulteile; };
$config['additional_fields']['count_modulteile']['set'] = false;
$config['additional_fields']['languagesofinstruction']['get'] =
function ($modul) { return $modul->languages; };
$config['additional_fields']['languagesofinstruction']['set'] = false;
$config['additional_fields']['display_name']['get'] =
function ($modul) { return $modul->getDisplayName(); };
$config['additional_fields']['count_modulteile']['get'] = function ($modul) {
return $modul->count_modulteile;
};
$config['additional_fields']['languagesofinstruction']['get'] = function ($modul) {
return $modul->languages;
};
$config['additional_fields']['display_name']['get'] = function ($modul) {
return $modul->getDisplayName();
};
$config['alias_fields']['flexnow_id'] = 'flexnow_modul';
......
......@@ -103,7 +103,6 @@ class Modulteil extends ModuleManagementModelTreeItem
$config['additional_fields']['count_lvgruppen']['get'] = function ($mt) {
return $mt->count_lvgruppen;
};
$config['additional_fields']['count_lvgruppen']['set'] = false;
parent::configure($config);
}
......
......@@ -56,11 +56,9 @@ class Semester extends SimpleORMap
$config['additional_fields']['absolute_seminars_count'] = [
'get' => 'seminarCounter',
'set' => false,
];
$config['additional_fields']['continuous_seminars_count'] = [
'get' => 'seminarCounter',
'set' => false,
];
$config['alias_fields']['token'] = 'semester_token';
......
......@@ -65,9 +65,9 @@ class StgteilAbschnitt extends ModuleManagementModelTreeItem
'on_store' => 'store'
];
$config['additional_fields']['count_module']['get'] =
function($fach) { return $fach->count_module; };
$config['additional_fields']['count_module']['set'] = false;
$config['additional_fields']['count_module']['get'] = function ($fach) {
return $fach->count_module;
};
$config['i18n_fields']['name'] = true;
$config['i18n_fields']['kommentar'] = true;
......
......@@ -32,12 +32,12 @@ class StgteilBezeichnung extends ModuleManagementModel
{
$config['db_table'] = 'mvv_stgteil_bez';
$config['additional_fields']['count_stgteile']['get'] =
function($stg_bez) { return $stg_bez->count_stgteile; };
$config['additional_fields']['count_stgteile']['set'] = false;
$config['additional_fields']['count_studiengaenge']['get'] =
function($stg_bez) { return $stg_bez->count_studiengaenge; };
$config['additional_fields']['count_studiengaenge']['set'] = false;
$config['additional_fields']['count_stgteile']['get'] = function ($stg_bez) {
return $stg_bez->count_stgteile;
};
$config['additional_fields']['count_studiengaenge']['get'] = function ($stg_bez) {
return $stg_bez->count_studiengaenge;
};
$config['i18n_fields']['name'] = true;
$config['i18n_fields']['name_kurz'] = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment