Commit 9606848d authored by Alexander Butenko's avatar Alexander Butenko

Fix for with() and autoload()

parent 9aceb949
......@@ -271,6 +271,7 @@ class dbObject {
private function getOne ($fields = null) {
$results = $this->db->getOne ($this->dbTable, $fields);
$this->processArrays ($results);
$this->data = $results;
$this->processWith ($results);
if ($this->returnType == 'Array')
return $results;
......@@ -296,6 +297,7 @@ class dbObject {
$results = $this->db->get ($this->dbTable, $limit, $fields);
foreach ($results as &$r) {
$this->processArrays ($r);
$this->data = $r;
$this->processWith ($r);
if ($this->returnType == 'Object') {
$item = new static ($r);
......@@ -446,6 +448,7 @@ class dbObject {
return;
foreach ($this->_with as $w)
$data[$w] = $this->$w;
$this->_with = Array();
}
......@@ -556,8 +559,9 @@ class dbObject {
}
private static function dbObjectAutoload ($classname) {
$filename = "models/". $classname .".php";
include ($filename);
$filename = static::$modelPath . $classname .".php";
if (file_exists ($filename))
include ($filename);
}
/*
......
......@@ -121,6 +121,13 @@ if (!is_array ($product['userId'])) {
exit;
}
$product = product::with('userId')->byId(5);
if (!is_object ($product->data['userId'])) {
echo "Error in with processing in getOne object";
exit;
}
$products = product::ArrayBuilder()->with('userId')->get(2);
if (!is_array ($products[0]['userId'])) {
echo "Error in with processing in get";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment