| @@ 64-73 (lines=10) @@ | ||
| 61 | ||
| 62 | /** |
|
| 63 | */ |
|
| 64 | protected function decode() |
|
| 65 | { |
|
| 66 | foreach ($this->attributes as $attribute) { |
|
| 67 | $value = $this->owner->getAttribute($attribute); |
|
| 68 | if (!$value instanceof JsonField) { |
|
| 69 | $value = new JsonField($value); |
|
| 70 | } |
|
| 71 | $this->owner->setAttribute($attribute, $value); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | */ |
|
| @@ 77-86 (lines=10) @@ | ||
| 74 | ||
| 75 | /** |
|
| 76 | */ |
|
| 77 | protected function encode() |
|
| 78 | { |
|
| 79 | foreach ($this->attributes as $attribute) { |
|
| 80 | $field = $this->owner->getAttribute($attribute); |
|
| 81 | if (!$field instanceof JsonField) { |
|
| 82 | $field = new JsonField($field); |
|
| 83 | } |
|
| 84 | $this->owner->setAttribute($attribute, (string)$field ?: $this->emptyValue); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | */ |
|