Skip to content

Commit 937d889

Browse files
authored
Fixed hidden fields.
Added guard check at the beginning of the method, removed name === 'hidden' (that was useless).
1 parent c1c9d65 commit 937d889

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

dbObject.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ public function __construct ($data = null) {
124124
* @return mixed
125125
*/
126126
public function __set ($name, $value) {
127-
if ($name === 'hidden')
128-
return;
129-
130127
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) !== false)
131128
return;
132129

@@ -141,12 +138,11 @@ public function __set ($name, $value) {
141138
* @return mixed
142139
*/
143140
public function __get ($name) {
144-
if ($name === 'hidden') /* Just in case... */
145-
return null;
146-
147-
if (isset ($this->data[$name]) && $this->data[$name] instanceof dbObject)
148-
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) === false)
149-
return $this->data[$name];
141+
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) === false)
142+
return null;
143+
144+
if (isset ($this->data[$name]) && $this->data[$name] instanceof dbObject)
145+
return $this->data[$name];
150146

151147
if (property_exists ($this, 'relations') && isset ($this->relations[$name])) {
152148
$relationType = strtolower ($this->relations[$name][0]);
@@ -170,8 +166,7 @@ public function __get ($name) {
170166
}
171167

172168
if (isset ($this->data[$name]))
173-
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) === false)
174-
return $this->data[$name];
169+
return $this->data[$name];
175170

176171
if (property_exists ($this->db, $name))
177172
return $this->db->$name;

0 commit comments

Comments
 (0)