Skip to content

Commit

Permalink
Replace deprecated identity_concept references
Browse files Browse the repository at this point in the history
  • Loading branch information
jglass-st committed Dec 19, 2024
1 parent a091edc commit 55e4aa0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Models/Concept.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Concept extends Model
{
Expand Down Expand Up @@ -33,10 +34,12 @@ public function deprecatedTo()
return $this->belongsTo("\App\Models\Concept", "deprecated_to");
}

public function setDeprecatedTo($concept)
public function setDeprecatedTo($replacementConcept)
{
$this->deprecated = true;
return $this->deprecatedTo()->associate($concept)

DB::table('identity_concepts')->where('concept_id', $this->id)->update(['concept_id' => $replacementConcept->id]);
return $this->deprecatedTo()->associate($replacementConcept)
->save();
}

Expand Down

0 comments on commit 55e4aa0

Please sign in to comment.