当前位置: 首页>>代码示例>>PHP>>正文


PHP ORM::__get方法代码示例

本文整理汇总了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);
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:34,代码来源:ORM_Tree.php

示例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);
 }
开发者ID:ready4god2513,项目名称:scs,代码行数:12,代码来源:cart_item.php

示例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);
 }
开发者ID:ready4god2513,项目名称:scs,代码行数:12,代码来源:variant.php

示例4: __get

 public function __get($prop)
 {
     if ('url' == $prop) {
         return url::site("subscribers/{$this->email}");
     }
     return parent::__get($prop);
 }
开发者ID:hdragomir,项目名称:ProjectsLounge,代码行数:7,代码来源:subscriber.php

示例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);
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:15,代码来源:background.php

示例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);
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:15,代码来源:dlsliderphoto.php

示例7: __get

 public function __get($column)
 {
     switch ($column) {
         case 'compatible_versions' or 'incompatible_versions':
             return unserialize(parent::__get($column));
         default:
             return parent::__get($column);
     }
 }
开发者ID:Zeelot,项目名称:yuriko_cms,代码行数:9,代码来源:dependency.php

示例8: __get

 public function __get($column)
 {
     switch ($column) {
         case 'installer':
             return (bool) parent::__get('installer');
         default:
             return parent::__get($column);
     }
 }
开发者ID:Zeelot,项目名称:yuriko_cms,代码行数:9,代码来源:plugin.php

示例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);
 }
开发者ID:rrsc,项目名称:beansbooks,代码行数:15,代码来源:ormencrypted.php

示例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;
     }
 }
开发者ID:ngonchan,项目名称:Kooshy,代码行数:16,代码来源:snippet.php

示例11: __get

 public function __get($key)
 {
     switch ($key) {
         case 'site':
             return $this->_site;
             break;
         default:
             return ORM::__get($key);
             break;
     }
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:11,代码来源:imagetype.php

示例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;
 }
开发者ID:b263,项目名称:kohana-dblog,代码行数:11,代码来源:log.php

示例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;
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:16,代码来源:journal.php

示例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);
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:15,代码来源:user.php

示例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);
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:22,代码来源:widget.php


注:本文中的ORM::__get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。