Skip to content

Commit

Permalink
correcao
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Morais authored and Bruno Morais committed Oct 20, 2024
1 parent 23065b4 commit b6b23fd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/ModelAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ public function getDataModelArray():array {
*/
public function fromMapToModel(array $params): void
{
$reflection = new \ReflectionClass($this);

foreach ($params as $key => $item) {
$this->dataModelArray[$key] = $item;
if (property_exists($this, $key)){
$this->{$key} = $item;
if ($reflection->hasProperty($key)) {
$property = $reflection->getProperty($key);
$property->setAccessible(true);
$property->setValue($this, $item);
}

$this->dataModelArray[$key] = $item;

}
}

Expand Down

0 comments on commit b6b23fd

Please sign in to comment.