Skip to content

Commit

Permalink
Logic continuity
Browse files Browse the repository at this point in the history
Previous logic would halt for no reason requiring the external code to handle this anomaly. Simple values are designed to handle $a->relation = $b->relation regardless of type.
  • Loading branch information
daftspunk committed Jan 6, 2025
1 parent 4b34ed4 commit d66ac6b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Database/Relations/AttachOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(Builder $query, Model $parent, $type, $id, $isPublic
public function setSimpleValue($value)
{
if (is_array($value)) {
$value = reset($value);
$value = current($value);
}

// Nulling the relationship
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Relations/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(Builder $query, Model $parent, $foreignKey, $localKe
public function setSimpleValue($value)
{
if (is_array($value)) {
return;
$value = current($value);
}

// Nulling the relationship
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Relations/MorphOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(Builder $query, Model $parent, $type, $id, $localKey
public function setSimpleValue($value)
{
if (is_array($value)) {
return;
$value = current($value);
}

// Nulling the relationship
Expand Down

0 comments on commit d66ac6b

Please sign in to comment.