mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Reverting changes made by gwoo
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3284 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ceb72b3415
commit
4347f25025
3 changed files with 79 additions and 92 deletions
|
@ -414,7 +414,7 @@ class DboMysqli extends DboSource {
|
|||
$resultRow = array();
|
||||
$i = 0;
|
||||
foreach ($row as $index => $field) {
|
||||
list($table, $column) = $this->map[$index];
|
||||
@list($table, $column) = $this->map[$index];
|
||||
$resultRow[$table][$column] = $row[$index];
|
||||
$i++;
|
||||
}
|
||||
|
|
|
@ -829,22 +829,6 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
return $sql;
|
||||
} else {
|
||||
if (isset($linkModel->assoc['conditions']) && !empty($linkModel->assoc['conditions'])) {
|
||||
$assocData['conditions'] = $linkModel->assoc['conditions'];
|
||||
}
|
||||
if (isset($linkModel->assoc['fields']) && !empty($linkModel->assoc['fields'])) {
|
||||
$assocData['fields'] = $linkModel->assoc['fields'];
|
||||
}
|
||||
if (isset($linkModel->assoc['order']) && !empty($linkModel->assoc['order'])) {
|
||||
$assocData['order'] = $linkModel->assocData['order'];
|
||||
}
|
||||
if (isset($linkModel->assoc['limit']) && !empty($linkModel->assoc['limit'])) {
|
||||
$assocData['limit'] = $linkModel->assocData['limit'];
|
||||
}
|
||||
if (isset($linkModel->assoc['offset']) && !empty($linkModel->assoc['offset'])) {
|
||||
$assocData['offset'] = $linkModel->assocData['offset'];
|
||||
}
|
||||
}
|
||||
$alias = $association;
|
||||
|
||||
|
@ -855,18 +839,19 @@ class DboSource extends DataSource {
|
|||
switch($type) {
|
||||
case 'hasOne':
|
||||
if ($external || isset($assocData['external'])) {
|
||||
|
||||
if (isset($assocData['finderQuery'])) {
|
||||
return $assocData['finderQuery'];
|
||||
}
|
||||
|
||||
if (!isset($assocData['limit'])) {
|
||||
$assocData['limit'] = $queryData['limit'];
|
||||
if (!isset($assocData['fields'])) {
|
||||
$assocData['fields'] = '';
|
||||
}
|
||||
if (!isset($assocData['offset'])) {
|
||||
$assocData['offset'] = $queryData['offset'];
|
||||
|
||||
$limit = '';
|
||||
|
||||
if (isset($queryData['limit']) && !empty($queryData['limit'])) {
|
||||
$limit = $this->limit($queryData['limit'], $queryData['offset']);
|
||||
}
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
|
||||
$sql = 'SELECT ';
|
||||
if ($this->goofyLimit) {
|
||||
|
@ -900,6 +885,9 @@ class DboSource extends DataSource {
|
|||
return $sql;
|
||||
|
||||
} else {
|
||||
if (!isset($assocData['fields'])) {
|
||||
$assocData['fields'] = '';
|
||||
}
|
||||
|
||||
if ($this->__bypass === false) {
|
||||
$fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
|
||||
|
@ -932,14 +920,14 @@ class DboSource extends DataSource {
|
|||
break;
|
||||
case 'belongsTo':
|
||||
if ($external || isset($assocData['external'])) {
|
||||
$limit = '';
|
||||
if (isset($assocData['limit'])) {
|
||||
$limit = $this->limit($assocData['limit'], $queryData['offset']);
|
||||
}
|
||||
|
||||
if (!isset($assocData['limit'])) {
|
||||
$assocData['limit'] = $queryData['limit'];
|
||||
if (!isset($assocData['fields'])) {
|
||||
$assocData['fields'] = '';
|
||||
}
|
||||
if (!isset($assocData['offset'])) {
|
||||
$assocData['offset'] = $queryData['offset'];
|
||||
}
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
|
||||
$sql = 'SELECT ';
|
||||
if ($this->goofyLimit) {
|
||||
|
@ -970,6 +958,9 @@ class DboSource extends DataSource {
|
|||
return $sql;
|
||||
|
||||
} else {
|
||||
if (!isset($assocData['fields'])) {
|
||||
$assocData['fields'] = '';
|
||||
}
|
||||
|
||||
if ($this->__bypass === false) {
|
||||
$fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
|
||||
|
@ -1012,10 +1003,12 @@ class DboSource extends DataSource {
|
|||
$sql = $assocData['finderQuery'];
|
||||
} else {
|
||||
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
$limit = '';
|
||||
if (isset($assocData['limit'])) {
|
||||
$limit = $this->limit($assocData['limit'], $queryData['offset']);
|
||||
}
|
||||
|
||||
$conditions = $assocData['conditions'];
|
||||
|
||||
$sql = 'SELECT ';
|
||||
|
||||
if ($this->goofyLimit) {
|
||||
|
@ -1037,7 +1030,6 @@ class DboSource extends DataSource {
|
|||
}
|
||||
|
||||
$sql .= $this->conditions($conditions);
|
||||
|
||||
$sql .= $this->order($assocData['order']);
|
||||
|
||||
if (!$this->goofyLimit) {
|
||||
|
@ -1052,7 +1044,10 @@ class DboSource extends DataSource {
|
|||
} else {
|
||||
$joinTbl = $this->fullTableName($assocData['joinTable']);
|
||||
|
||||
$limit = $this->limit($assocData['limit'], $assocData['offset']);
|
||||
$limit = '';
|
||||
if (isset($assocData['limit'])) {
|
||||
$limit = $this->limit($assocData['limit'], $queryData['offset']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT ';
|
||||
|
||||
|
@ -1088,7 +1083,6 @@ class DboSource extends DataSource {
|
|||
$sql .= ' = ' . $this->name($alias) . '.' . $this->name($linkModel->primaryKey);
|
||||
|
||||
$sql .= $this->conditions($assocData['conditions']);
|
||||
|
||||
$sql .= $this->order($assocData['order']);
|
||||
|
||||
if (!$this->goofyLimit) {
|
||||
|
|
|
@ -293,16 +293,9 @@ class Model extends Object {
|
|||
var $__associationKeys = array(
|
||||
'belongsTo' => array('className', 'conditions', 'order', 'foreignKey', 'counterCache'),
|
||||
'hasOne' => array('className', 'conditions', 'order', 'foreignKey', 'dependent'),
|
||||
'hasMany' => array('className', 'conditions', 'order','limit','offset', 'foreignKey', 'fields', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
|
||||
'hasAndBelongsToMany' => array('className', 'joinTable', 'fields', 'foreignKey', 'associationForeignKey', 'conditions', 'order','limit','offset', 'uniq', 'finderQuery', 'deleteQuery', 'insertQuery', 'with')
|
||||
'hasMany' => array('className', 'conditions', 'order', 'foreignKey', 'fields', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
|
||||
'hasAndBelongsToMany' => array('className', 'joinTable', 'fields', 'foreignKey', 'associationForeignKey', 'conditions', 'order', 'uniq', 'finderQuery', 'deleteQuery', 'insertQuery', 'with')
|
||||
);
|
||||
/**
|
||||
* Access to the association property keys
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $assoc = array('conditions', 'fields', 'order', 'limit','offset');
|
||||
|
||||
/**
|
||||
* Holds provided/generated association key names and other data for all associations
|
||||
|
|
Loading…
Add table
Reference in a new issue