Misc fixes from live site

This commit is contained in:
Deon George
2013-07-05 16:11:37 +10:00
parent 3499776ddc
commit f3d2c1fe8d
21 changed files with 80 additions and 65 deletions

View File

@@ -65,6 +65,13 @@ abstract class ORM extends Kohana_ORM {
return $this->where('status','=',TRUE);
}
/**
* Overrides Kohana cache so that it can be globally disabled.
*/
public function cached($lifetime=NULL) {
return $this->_db->caching() ? parent::cached($lifetime) : $this;
}
public function clear() {
$this->_formated = FALSE;
$this->_object_formated = array();
@@ -151,7 +158,7 @@ abstract class ORM extends Kohana_ORM {
$query->and_where($k,$s,$v);
}
$c = 0;
$c = 0;
foreach ((empty($options['object']) ? $query->find_all() : $query->execute()) as $o) {
// If we got here via a DB query, we need to reload our ORM object from the result.
if (! is_object($o)) {
@@ -174,7 +181,7 @@ abstract class ORM extends Kohana_ORM {
}
$k = '';
foreach ($label as $k => $details)
foreach ($label as $k => $details)
foreach ($details as $lvalue)
$k = preg_replace('/%s/',$o->resolve($lvalue),$k,1);