本文整理汇总了PHP中ORM::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::__get方法的具体用法?PHP ORM::__get怎么用?PHP ORM::__get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::__get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Overload ORM::__get to support "parent" and "children" properties.
*
* @param string column name
* @return mixed
*/
public function __get($column)
{
if ($column === 'parent') {
if (empty($this->related[$column])) {
// Load child model
$model = ORM::factory(inflector::singular($this->children));
if (array_key_exists($this->parent_key, $this->object)) {
// Find children of this parent
$model->where($model->primary_key, $this->object[$this->parent_key])->find();
}
$this->related[$column] = $model;
}
return $this->related[$column];
} elseif ($column === 'children') {
if (empty($this->related[$column])) {
$model = ORM::factory(inflector::singular($this->children));
if ($this->children === $this->table_name) {
// Load children within this table
$this->related[$column] = $model->where($this->parent_key, $this->object[$this->primary_key])->find_all();
} else {
// Find first selection of children
$this->related[$column] = $model->where($this->foreign_key(), $this->object[$this->primary_key])->where($this->parent_key, NULL)->find_all();
}
}
return $this->related[$column];
}
return parent::__get($column);
}
示例2: __get
/**
* Get the product name
* @developer Brandon Hansen
* @date Nov 1, 2010
*/
public function __get($key)
{
if ($key == 'name') {
return $this->product_name();
}
return parent::__get($key);
}
示例3: __get
/**
* Don't make the user type in anything more than pseudo property names
* @developer Brandon Hansen
* @date Nov 1, 2010
*/
public function __get($key)
{
if ($key == 'name') {
return $this->variant_title();
}
return parent::__get($key);
}
示例4: __get
public function __get($prop)
{
if ('url' == $prop) {
return url::site("subscribers/{$this->email}");
}
return parent::__get($prop);
}
示例5: __get
/**
* Calls a function through the get param if one is available.
* --could not add globally as some models won't work with it.
* --(cool feature, though)
* @author Brent Allen
* @param Object key the key sent by auto-calling __get
* @return Object The return of the function, or the parent __get
*/
public function __get($key)
{
if (method_exists(Model_Background, $key)) {
return $this->{$key}();
}
return parent::__get($key);
}
示例6: __get
/**
* Calls a function through the get param if one is available.
* --could not add globally as some models won't work with it.
* --(cool feature, though)
* @author Brent Allen
* @param Object key the key sent by auto-calling __get
* @return Object The return of the function, or the parent __get
*/
public function __get($key)
{
if (method_exists(Model_DLSliderPhoto, $key)) {
return $this->{$key}();
}
return parent::__get($key);
}
示例7: __get
public function __get($column)
{
switch ($column) {
case 'compatible_versions' or 'incompatible_versions':
return unserialize(parent::__get($column));
default:
return parent::__get($column);
}
}
示例8: __get
public function __get($column)
{
switch ($column) {
case 'installer':
return (bool) parent::__get('installer');
default:
return parent::__get($column);
}
}
示例9: __get
/**
* Necessary override to enable per-column encryption.
* @param String $column
* @return mixed
*/
public function __get($column)
{
if (in_array($column, $this->_encrypted_compressed_columns)) {
return gzuncompress(Encrypt::instance()->decode(parent::__get($column)));
}
if (in_array($column, $this->_encrypted_columns)) {
return Encrypt::instance()->decode(parent::__get($column));
}
return parent::__get($column);
}
示例10: __get
/**
* Overrides ORM get magic method to allow for enabled
* @param string name of column/relationship to return
* @return mixed
*/
public function __get($column)
{
if ($column != 'enabled') {
return parent::__get($column);
} else {
if ($this->_enabled === NULL) {
$this->_enabled = ORM::factory('site_snippet')->where('site_id', '=', KMS::instance('site')->id)->where('snippet_id', '=', $this->id)->order_by('snippet_id', 'ASC')->find()->enabled;
}
return $this->_enabled;
}
}
示例11: __get
public function __get($key)
{
switch ($key) {
case 'site':
return $this->_site;
break;
default:
return ORM::__get($key);
break;
}
}
示例12: __get
public function __get($column)
{
switch ($column) {
case 'tstamp':
$val = strftime(self::$time_format, parent::__get('tstamp'));
break;
default:
$val = parent::__get($column);
}
return $val;
}
示例13: __get
/**
* Decrypt the data when taking it out of the database
* @Developer brandon
* @Date May 18, 2010
*/
public function __get($key)
{
$value = parent::__get($key);
if (in_array($key, array('content', 'title'))) {
if ($value) {
$encrypt = new Encrypt();
$value = $encrypt->decode($value);
}
}
return $value;
}
示例14: __get
/**
* Allows us to get the unqiue value of regardless of what 'username|}email' type is selected.
* @param $value
*/
public function __get($value)
{
if ($value === 'unique') {
if (!count($this->config)) {
$this->config = Kohana::config($this->config_name);
}
// return the unique field whether it is
$value = $this->config['columns']['unique'];
}
return parent::__get($value);
}
示例15: __get
/**
* Reading data from inaccessible properties
*
* @param string $field
* @return mixed
*
* @uses Route::get
* @uses Route::uri
* @uses System::icons
*/
public function __get($field)
{
switch ($field) {
case 'edit_url':
return Route::get('admin/widget')->uri(array('id' => $this->id, 'action' => 'edit'));
break;
case 'icons':
return System::icons();
break;
}
return parent::__get($field);
}