Skip to content

Commit

Permalink
Fix DAO after function removal; fix namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Dec 7, 2024
1 parent abd0e4e commit b8e3419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/announcement/AnnouncementTypeDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use APP\core\Application;
use Generator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\DB;

class AnnouncementTypeDAO extends \PKP\db\DAO
Expand Down
5 changes: 4 additions & 1 deletion classes/db/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,10 @@ public function updateDataObjectSettings(string $tableName, DataObject $dataObje
$updateArray['setting_type'] = null;
// Convert the data value and implicitly set the setting type.
$updateArray['setting_value'] = $this->convertToDB($value, $updateArray['setting_type']);
$this->replace($tableName, $updateArray, $idFields);

$matchValues = array_filter($updateArray, fn ($key) => in_array($key, $idFields), ARRAY_FILTER_USE_KEY);
$additionalValues = array_filter($updateArray, fn ($key) => !in_array($key, $idFields), ARRAY_FILTER_USE_KEY);
DB::table($tableName)->updateOrInsert($matchValues, $additionalValues);
}
} else {
// Data is maintained "sparsely". Only set fields will be
Expand Down

0 comments on commit b8e3419

Please sign in to comment.