@@ 46-55 (lines=10) @@ | ||
43 | ||
44 | /** |
|
45 | */ |
|
46 | protected function decode() |
|
47 | { |
|
48 | foreach ($this->attributes as $attribute) { |
|
49 | $value = $this->owner->getAttribute($attribute); |
|
50 | if (!$value instanceof JsonField) { |
|
51 | $value = new JsonField($value); |
|
52 | } |
|
53 | $this->owner->setAttribute($attribute, $value); |
|
54 | } |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | */ |
|
@@ 59-68 (lines=10) @@ | ||
56 | ||
57 | /** |
|
58 | */ |
|
59 | protected function encode() |
|
60 | { |
|
61 | foreach ($this->attributes as $attribute) { |
|
62 | $field = $this->owner->getAttribute($attribute); |
|
63 | if (!$field instanceof JsonField) { |
|
64 | $field = new JsonField($field); |
|
65 | } |
|
66 | $this->owner->setAttribute($attribute, (string)$field ?: null); |
|
67 | } |
|
68 | } |
|
69 | ||
70 | /** |
|
71 | */ |
|
@@ 72-80 (lines=9) @@ | ||
69 | ||
70 | /** |
|
71 | */ |
|
72 | protected function encodeValidate() |
|
73 | { |
|
74 | foreach ($this->attributes as $attribute) { |
|
75 | $field = $this->owner->getAttribute($attribute); |
|
76 | if ($field instanceof JsonField) { |
|
77 | $this->owner->setAttribute($attribute, (string)$field ?: null); |
|
78 | } |
|
79 | } |
|
80 | } |
|
81 | } |
|
82 |