Skip to content

Commit

Permalink
Fix to get attribute directly, avoids calling an unnecessary and pote… (
Browse files Browse the repository at this point in the history
#18)

* Fix to get attribute directly, avoids calling an unnecessary and potentially expensive magic method

* Refactor for case of computed attribute
  • Loading branch information
mfos239 authored and darrylkuhn committed Apr 8, 2019
1 parent d749cdc commit 3027abf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Dialect/Json.php
Expand Up @@ -82,7 +82,13 @@ public function inspectJsonColumns()
if (!$this->showJsonColumns) {
$this->hidden[] = $col;
}
$obj = json_decode($this->$col);

if(array_key_exists($col, $this->attributes)) {
$obj = json_decode($this->attributes[$col]);
}
else {
$obj = json_decode($this->$col);
}

if (is_object($obj)) {
foreach ($obj as $key => $value) {
Expand Down

0 comments on commit 3027abf

Please sign in to comment.