Skip to content

Commit

Permalink
add additional filter in federation entity
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed May 24, 2024
1 parent a421d53 commit 195bd57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/Models/Federation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Federation extends Model
'xml_id',
'xml_name',
'filters',
'additional_filters',
'explanation',
];

Expand Down
9 changes: 8 additions & 1 deletion app/Traits/DumpFromGit/CreateFederationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ public function createFederations(): void
$unknown[$cfgfile]['xml_name'] = $xml_name[1];
}


foreach ($unknown as $fed) {
DB::transaction(function () use ($fed) {

$filtersArray = explode(', ', $fed['filters']);
$additionalFilters = sizeof($filtersArray)>1;


DB::transaction(function () use ($additionalFilters, $fed) {
$federation = Federation::create([
'name' => $fed['xml_id'],
'description' => $fed['xml_id'],
Expand All @@ -48,6 +54,7 @@ public function createFederations(): void
'xml_id' => $fed["xml_id"],
'xml_name' => $fed["xml_name"],
'filters' => $fed["filters"],
'additional_filters' => $additionalFilters,
'explanation' => 'Imported from Git repository.',
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function up()
$table->string('xml_id', 128)->unique();
$table->string('xml_name', 128)->unique();
$table->string('filters')->unique();
$table->boolean('additional_filters')->default(0);
$table->boolean('approved')->default(0);
$table->boolean('active')->default(0);
$table->string('explanation');
Expand Down

0 comments on commit 195bd57

Please sign in to comment.