Skip to content
Snippets Groups Projects
Commit d887b56a authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #13826 TIME 0:15 set enable notEmpty in indexing model field + do not use model in migration

parent e2d09896
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ foreach ($customs as $custom) {
$loadedXml = simplexml_load_file($path);
if ($loadedXml) {
$indexingModels = \IndexingModel\models\IndexingModelModel::get(['select'=> ['id']]);
$indexingModels = \IndexingModel\models\IndexingModelModel::get(['select'=> ['id']]);
if (!empty($indexingModels)) {
$indexingModelsId = array_column($indexingModels, 'id');
}
......@@ -78,11 +78,15 @@ foreach ($customs as $custom) {
if (!empty($indexingModelsId)) {
foreach ($indexingModelsId as $indexingModelId) {
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $indexingModelId,
'identifier' => 'indexingCustomField_'.$fieldId,
'mandatory' => 'false',
'unit' => 'mail'
\SrcCore\models\DatabaseModel::insert([
'table' => 'indexing_models_fields',
'columnsValues' => [
'model_id' => $indexingModelId,
'identifier' => 'indexingCustomField_'.$fieldId,
'mandatory' => 'false',
'default_value' => null,
'unit' => 'mail'
]
]);
}
}
......
......@@ -62,11 +62,15 @@ foreach ($customs as $custom) {
]);
if (!empty($indexingModels)) {
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $modelId,
'identifier' => 'indexingCustomField_'.$fieldId,
'mandatory' => 'false',
'unit' => 'mail'
\SrcCore\models\DatabaseModel::insert([
'table' => 'indexing_models_fields',
'columnsValues' => [
'model_id' => $modelId,
'identifier' => 'indexingCustomField_'.$fieldId,
'mandatory' => 'false',
'default_value' => null,
'unit' => 'mail'
]
]);
}
}
......
......@@ -125,12 +125,15 @@ foreach ($customs as $custom) {
}
}
foreach ($datasToImport as $id => $defaultValue) {
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $modelId,
'identifier' => $id,
'mandatory' => $defaultValue['mandatory'],
'default_value' => $defaultValue['default_value'],
'unit' => $defaultValue['unit']
\SrcCore\models\DatabaseModel::insert([
'table' => 'indexing_models_fields',
'columnsValues' => [
'model_id' => $modelId,
'identifier' => $id,
'mandatory' => $defaultValue['mandatory'],
'default_value' => $defaultValue['default_value'],
'unit' => $defaultValue['unit']
]
]);
}
++$migrated;
......
......@@ -38,7 +38,7 @@ class IndexingModelFieldModel
public static function create(array $args)
{
ValidatorModel::notEmpty($args, ['model_id', 'mandatory', 'identifier', 'unit']);
ValidatorModel::notEmpty($args, ['model_id', 'enabled', 'mandatory', 'identifier', 'unit']);
ValidatorModel::stringType($args, ['enabled', 'mandatory', 'identifier', 'unit']);
ValidatorModel::intVal($args, ['model_id']);
......
......@@ -985,24 +985,28 @@ class ResControllerTest extends TestCase
'model_id' => 1,
'identifier' => 'indexingCustomField_1',
'mandatory' => 'true',
'enabled ' => 'true',
'unit' => 'mail'
]);
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => 1,
'identifier' => 'indexingCustomField_2',
'mandatory' => 'false',
'enabled ' => 'true',
'unit' => 'mail'
]);
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => 1,
'identifier' => 'indexingCustomField_3',
'mandatory' => 'false',
'enabled ' => 'true',
'unit' => 'mail'
]);
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => 1,
'identifier' => 'indexingCustomField_4',
'mandatory' => 'false',
'enabled ' => 'true',
'unit' => 'mail'
]);
......
......@@ -47,6 +47,7 @@ class SummarySheetControllerTest extends TestCase
'model_id' => 1,
'identifier' => 'indexingCustomField_4',
'mandatory' => 'false',
'enabled ' => 'true',
'unit' => 'mail'
]);
......@@ -54,6 +55,7 @@ class SummarySheetControllerTest extends TestCase
'model_id' => 1,
'identifier' => 'recipients',
'mandatory' => 'false',
'enabled ' => 'true',
'unit' => 'mail'
]);
......
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