public function __get($property) { if ($this->hasMethod($method = "get{$property}")) { return $this->{$method}(); } elseif (isset($this->data[strtolower($property)])) { return $this->data[strtolower($property)]; } else { return parent::__get($property); } }
function __get($name) { if (isset(self::$registered_handlers[$name])) { $collectionClass = self::$registered_handlers[$name]; $res = new $collectionClass(); $res->parent = $this; $res->linkFragment = $name; return $res; } return parent::__get($name); }
/** * Insures that any array or object is wrapped properly */ function __get($field) { $val = $this->wrapObject(parent::__get($field)); if (isset($this->varName) && is_object($val) && $val instanceof ViewableWrapper) { $val->setVar($this->varName . '_' . $field); // if this variable isn't live, none of it's children should be if (!$this->isLiveVar($field)) { $val->setLiveVars(false); } } return $val; }
/** * Proxy the field requests to the underlying data source * * @param mixed $property * @return mixed */ public function __get($property) { if ($this->dataSource && $this->dataSource->ID) { // check for the fully realised field name $name = strpos($property, LayerManager::FIELD_SEPARATOR) ? $property : $this->realisedName . LayerManager::FIELD_SEPARATOR . $property; $val = $this->dataSource->__get($name); if ($val) { return $val; } // check has_one and many_many if ($this->dataSource->hasMethod($name)) { return $this->dataSource->{$name}(); } // otherwise, just send the base property reference through $val = $this->dataSource->__get($property); if ($val) { return $val; } } return parent::__get($property); }