Skip to content

Commit

Permalink
fix: check null during refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed Oct 11, 2024
1 parent 11ec112 commit d7c7435
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ public function with(array $relations): Model
*/
public function refresh(): void{
$model = $this->recordManager->getById($this->getName(), $this->getId());
$this->cleanModel();
$this->setLoadedProperties($model->getSelfProperties());
$this->setLoaded();
if(!is_null($model)){
$this->cleanModel();
$this->setLoadedProperties($model->getSelfProperties());
$this->setLoaded();
}
}

/**
Expand Down

0 comments on commit d7c7435

Please sign in to comment.