Skip to content

Commit 86809e9

Browse files
committed
Update PHP minimum version to 8.0 and dependencies to latest compatible version
1 parent 79afb5a commit 86809e9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Mapper/DataMapper.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ public function fill(array $columns): void
483483
$fillable = $this->mapper->getFillable();
484484
$guarded = $this->mapper->getGuarded();
485485

486-
if (!empty($fillable)) {
486+
if (count($fillable) > 0) {
487487
$columns = array_intersect_key($columns, array_flip($fillable));
488-
} elseif (!empty($guarded)) {
488+
} elseif (count($guarded) > 0) {
489489
$columns = array_diff_key($columns, array_flip($guarded));
490490
}
491491

@@ -502,7 +502,7 @@ public function fill(array $columns): void
502502
public function markAsSaved(mixed $id): bool
503503
{
504504
$primaryKey = $this->mapper->getPrimaryKey();
505-
if (!$primaryKey->isComposite()) {
505+
if ($primaryKey->isComposite() === false) {
506506
$columns = $primaryKey->columns();
507507
$this->rawColumns[$columns[0]] = $id;
508508
} else {
@@ -515,7 +515,7 @@ public function markAsSaved(mixed $id): bool
515515
$this->isNew = false;
516516
$this->modified = [];
517517

518-
if (!empty($this->pendingLinks)) {
518+
if (count($this->pendingLinks) > 0) {
519519
$this->executePendingLinkage();
520520
}
521521

@@ -537,7 +537,11 @@ public function markAsUpdated(?string $updatedAt = null): bool
537537

538538
$this->modified = [];
539539

540-
if (!empty($this->pendingLinks)) {
540+
// some relation already loaded still in the cache
541+
// so force reload it
542+
$this->relations = [];
543+
544+
if (count($this->pendingLinks) > 0) {
541545
$this->executePendingLinkage();
542546
}
543547

0 commit comments

Comments
 (0)