Skip to content
Snippets Groups Projects
Commit 8dcc2a46 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #21441 : auto create custom fields root thesaurus as needed

parent 98c9dbd3
3 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1075Dev#21441 creer des facettes a partir des custom fields
......@@ -51,8 +51,16 @@ class Class_CodifThesaurusLoader extends Storm_Model_Loader {
public function findCustomFieldsRoot() {
return Class_CodifThesaurus::getLoader()
->findFirstBy(['id_thesaurus' => Class_CodifThesaurus::ROOT_CUSTOMFIELD_ID]);
if ($root = Class_CodifThesaurus::getLoader()
->findFirstBy(['id_thesaurus' => Class_CodifThesaurus::ROOT_CUSTOMFIELD_ID]))
return $root;
$attributes = ['id_thesaurus' => Class_CodifThesaurus::ROOT_CUSTOMFIELD_ID,
'libelle' => 'Champs personnalisés',
'code' => Class_CodifThesaurus::CODE_CUSTOMFIELDS];
$root = Class_CodifThesaurus::newInstance($attributes);
return $root->save() ? $root : null;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment