本文整理汇总了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;
}
}