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


PHP Kohana_Exception::getTraceAsString方法代码示例

本文整理汇总了PHP中Kohana_Exception::getTraceAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana_Exception::getTraceAsString方法的具体用法?PHP Kohana_Exception::getTraceAsString怎么用?PHP Kohana_Exception::getTraceAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana_Exception的用法示例。


在下文中一共展示了Kohana_Exception::getTraceAsString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __get

 /**
  * Handles retrieval of all model values, relationships, and metadata.
  *
  * @param   string $column Column name
  * @return  mixed
  */
 public function __get($column)
 {
     if (array_key_exists($column, $this->_object)) {
         return in_array($column, $this->_serialize_columns) ? $this->_unserialize_value($this->_object[$column]) : $this->_object[$column];
     } elseif (isset($this->_related[$column])) {
         // Return related model that has already been fetched
         return $this->_related[$column];
     } elseif (isset($this->_belongs_to[$column])) {
         $model = $this->_related($column);
         // Use this model's column and foreign model's primary key
         $col = $model->_object_name . '.' . $model->_primary_key;
         $val = $this->_object[$this->_belongs_to[$column]['foreign_key']];
         // Make sure we don't run WHERE "AUTO_INCREMENT column" = NULL queries. This would
         // return the last inserted record instead of an empty result.
         // See: http://mysql.localhost.net.ar/doc/refman/5.1/en/server-session-variables.html#sysvar_sql_auto_is_null
         if ($val !== NULL) {
             $model->where($col, '=', $val)->find();
         }
         return $this->_related[$column] = $model;
     } elseif (isset($this->_has_one[$column])) {
         $model = $this->_related($column);
         // Use this model's primary key value and foreign model's column
         $col = $model->_object_name . '.' . $this->_has_one[$column]['foreign_key'];
         $val = $this->pk();
         $model->where($col, '=', $val)->find();
         return $this->_related[$column] = $model;
     } elseif (isset($this->_has_many[$column])) {
         $model = ORM::factory($this->_has_many[$column]['model']);
         if (isset($this->_has_many[$column]['through'])) {
             // Grab has_many "through" relationship table
             $through = $this->_has_many[$column]['through'];
             // Join on through model's target foreign key (far_key) and target model's primary key
             $join_col1 = $through . '.' . $this->_has_many[$column]['far_key'];
             $join_col2 = $model->_object_name . '.' . $model->_primary_key;
             $model->join($through)->on($join_col1, '=', $join_col2);
             // Through table's source foreign key (foreign_key) should be this model's primary key
             $col = $through . '.' . $this->_has_many[$column]['foreign_key'];
             $val = $this->pk();
         } else {
             // Simple has_many relationship, search where target model's foreign key is this model's primary key
             $col = $model->_object_name . '.' . $this->_has_many[$column]['foreign_key'];
             $val = $this->pk();
         }
         return $model->where($col, '=', $val);
     } else {
         echo get_class($this) . " has no " . $column;
         $e = new Kohana_Exception('The ' . $column . '  property does not exist in the ' . get_class($this) . ' class');
         $fh = fopen('/tmp/grisha.log', 'a');
         fwrite($fh, $e->getTraceAsString());
         fclose($fh);
         throw $e;
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:59,代码来源:orm.php


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