Skip to content

Commit

Permalink
fix Halcyon model
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Jan 29, 2024
1 parent 3fcbcc0 commit 191a4bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Extension/ExtendableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public function addDynamicProperty($dynamicName, $value = null)
self::$extendableGuardProperties = false;

array_set($this->extensionData['dynamicProperties'], $dynamicName, $value);
$this->extendableSet($dynamicName, $value);

self::$extendableGuardProperties = true;
}
Expand Down Expand Up @@ -419,7 +418,7 @@ public function extendableSet($name, $value)
* Setting an undefined property
*/
if (!self::$extendableGuardProperties) {
$this->{$name} = $value;
array_set($this->extensionData['dynamicProperties'], $name, $value);
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/Halcyon/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,15 @@ public static function cacheMutatedAttributes($class)
static::$mutatorCache[$class] = $mutatedAttributes;
}

public function addDynamicProperty($dynamicName, $value = null)
{
if (isset($this->attributes[$dynamicName])) {
return;
}

$this->setAttribute($dynamicName, $value);
}

/**
* Dynamically retrieve attributes on the model.
*
Expand Down

0 comments on commit 191a4bd

Please sign in to comment.