本文整理汇总了PHP中CI_Model::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Model::__get方法的具体用法?PHP CI_Model::__get怎么用?PHP CI_Model::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Model
的用法示例。
在下文中一共展示了CI_Model::__get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
if ($name == 'table') {
return $this->{$name};
}
return parent::__get($name);
}
示例2: __get
public function __get($property_name)
{
if (isset($this->{$property_name})) {
return $this->{$property_name};
}
return parent::__get($property_name);
}
示例3: __get
public function __get($name)
{
$value = $this->getAttribute($name);
if (!is_null($value)) {
return $value;
}
return parent::__get($name);
}
示例4: __get
public function __get($name)
{
if (array_key_exists($name, $this->attributes)) {
return $this->attributes[$name];
} else {
return parent::__get($name);
}
}
示例5: __get
/**
* @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);
}
示例6: __get
/**
* __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']);
}
示例7: __get
/**
* __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']);
}
示例8:
function __get($key)
{
if (isset($this->_attributes[$key])) {
return $this->_attributes[$key];
} else {
return parent::__get($key);
}
}
示例9: __get
public function __get($name)
{
if ($name == 'db') {
$this->_init_db();
return self::$db_default;
} else {
return parent::__get($name);
}
}
示例10: __get
/**
* 取得属性值
* @param string $key
* @return mixed
*/
public function __get($key)
{
if (isset($this->attr[$key])) {
return $this->attr[$key];
} else {
return parent::__get($key);
}
}
示例11: __get
/**
* 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);
}