public function __get($name) { if ($name == 'table') { return $this->{$name}; } return parent::__get($name); }
public function __get($property_name) { if (isset($this->{$property_name})) { return $this->{$property_name}; } return parent::__get($property_name); }
public function __get($name) { $value = $this->getAttribute($name); if (!is_null($value)) { return $value; } return parent::__get($name); }
public function __get($name) { if (array_key_exists($name, $this->attributes)) { return $this->attributes[$name]; } else { return parent::__get($name); } }
/** * @param string $name * @return mixed */ public function __get($name) { if (!property_exists($this, $name)) { if (array_key_exists($name, $this->labels())) { $this->{$name} = ""; return $this->{$name}; } } return parent::__get($name); }
/** * __get magic * @method __get * @param mixed * @return mixed */ public function __get($key) { // This method should be called when trying to access another Model, or to store results on an existing instance; so these are the only verifications we'll do here. // First, we have to check if we're trying to retrieve some attributes attached to the Manager only if (in_array($key, array('_models', '_map'))) { return $key; } else { $manager = get_instance()->{strtolower(get_class($this))}; if (in_array($key, $manager->_models)) { return parent::__get($key); } } $debug = debug_backtrace(); show_error('Cannot access undefined property \'' . $key . '\' of class ' . get_class($this) . '.<br /><br /><b>Filename :</b> ' . $debug[0]['file'] . '<br /><b>Function :</b> ' . $debug[1]['function'] . '<br /><b>Line number :</b> ' . $debug[0]['line']); }
/** * __get magic override * @method __get * @public * @param string * @return object */ public function __get($key) { // This method should ONLY be called when trying to access another CI's DB Object or model, so these are the only verifications we'll do here. if (strpos($key, 'db_') !== false) { if (!isset(CI()->{$key})) { CI()->{$key} = CI()->load->database(str_replace('db_', '', $key), TRUE); CI()->{$key}->initialize(); } return parent::__get($key); } elseif (in_array($key, Manager()->getModels(get_class($this)))) { return CI()->{$key}; } // Nothing returned, an error must be thrown $debug = debug_backtrace(); show_error('Cannot access undefined property "' . $key . '" of class "' . get_class($this) . '".<br /><br /><b>Filename :</b> ' . $debug[0]['file'] . '<br /><b>Function :</b> ' . $debug[1]['function'] . '<br /><b>Line number :</b> ' . $debug[0]['line']); }
function __get($key) { if (isset($this->_attributes[$key])) { return $this->_attributes[$key]; } else { return parent::__get($key); } }
public function __get($name) { if ($name == 'db') { $this->_init_db(); return self::$db_default; } else { return parent::__get($name); } }
/** * 取得属性值 * @param string $key * @return mixed */ public function __get($key) { if (isset($this->attr[$key])) { return $this->attr[$key]; } else { return parent::__get($key); } }
/** * Returns a property value based on its name. * Do not call this method. This is a PHP magic method that we override * to allow using the following syntax to read a property or obtain event handlers: * <pre> * $value=$model->propertyName; [will be called $this->get_property_name()] * $value=$model->property_name; [will be called $this->get_property_name()] * $value=$model->load; [will be called $controller->load] * </pre> * * @param string $name the property name * * @return mixed the property value * @see __set */ public function __get($name) { $getter = 'get' . $name; $getter2 = 'get_' . $name; $getter3 = 'get_' . self::underscore_from_camel_case($name); if (method_exists($this, $getter)) { return $this->{$getter}(); } elseif (method_exists($this, $getter2)) { return $this->{$getter2}(); } elseif (method_exists($this, $getter3)) { return $this->{$getter3}(); } return parent::__get($name); }