Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into add-MagicActiveRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed May 24, 2024
2 parents 926adde + ab3c08b commit c0503c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Trait/MagicPropertiesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function __unset(string $name): void
if ($this->hasAttribute($name)) {
unset($this->attributes[$name]);

if (property_exists($this, $name)) {
if ($name !== 'attributes' && isset(get_object_vars($this)[$name])) {
$this->$name = null;
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public function __set(string $name, mixed $value): void

public function getAttribute(string $name): mixed
{
if (property_exists($this, $name)) {
if ($name !== 'attributes' && property_exists($this, $name)) {
return get_object_vars($this)[$name] ?? null;
}

Expand Down Expand Up @@ -266,7 +266,7 @@ public function canSetProperty(string $name, bool $checkVars = true): bool

protected function populateAttribute(string $name, mixed $value): void
{
if (property_exists($this, $name)) {
if ($name !== 'attributes' && property_exists($this, $name)) {
$this->$name = $value;
} else {
$this->attributes[$name] = $value;
Expand Down

0 comments on commit c0503c1

Please sign in to comment.