Commit c1c9d650 authored by Mariano Scazzariello's avatar Mariano Scazzariello Committed by GitHub

Add "hidden" columns/fields into dbObject

parent 04cd1ab1
......@@ -124,6 +124,12 @@ class dbObject {
* @return mixed
*/
public function __set ($name, $value) {
if ($name === 'hidden')
return;
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) !== false)
return;
$this->data[$name] = $value;
}
......@@ -135,8 +141,12 @@ class dbObject {
* @return mixed
*/
public function __get ($name) {
if ($name === 'hidden') /* Just in case... */
return null;
if (isset ($this->data[$name]) && $this->data[$name] instanceof dbObject)
return $this->data[$name];
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) === false)
return $this->data[$name];
if (property_exists ($this, 'relations') && isset ($this->relations[$name])) {
$relationType = strtolower ($this->relations[$name][0]);
......@@ -159,9 +169,9 @@ class dbObject {
}
}
if (isset ($this->data[$name])) {
return $this->data[$name];
}
if (isset ($this->data[$name]))
if (property_exists ($this, 'hidden') && array_search ($name, $this->hidden) === false)
return $this->data[$name];
if (property_exists ($this->db, $name))
return $this->db->$name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment