mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
2fa2de441f
commit
3becdc5959
2 changed files with 9 additions and 6 deletions
|
@ -101,13 +101,16 @@ class TranslateBehavior extends ModelBehavior {
|
|||
} else {
|
||||
$tablePrefix = $db->config['prefix'];
|
||||
}
|
||||
$joinTable = new StdClass();
|
||||
$joinTable->tablePrefix = $tablePrefix;
|
||||
$joinTable->table = $RuntimeModel->table;
|
||||
|
||||
if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) {
|
||||
$query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
|
||||
$query['joins'][] = array(
|
||||
'type' => 'INNER',
|
||||
'alias' => $RuntimeModel->alias,
|
||||
'table' => $db->name($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier($RuntimeModel->alias.'.foreign_key'),
|
||||
$RuntimeModel->alias.'.model' => $model->name,
|
||||
|
@ -170,7 +173,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$query['joins'][] = array(
|
||||
'type' => 'LEFT',
|
||||
'alias' => 'I18n__'.$field.'__'.$_locale,
|
||||
'table' => $db->name($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
|
||||
'I18n__'.$field.'__'.$_locale.'.model' => $model->name,
|
||||
|
@ -184,7 +187,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$query['joins'][] = array(
|
||||
'type' => 'LEFT',
|
||||
'alias' => 'I18n__'.$field,
|
||||
'table' => $db->name($tablePrefix . $RuntimeModel->useTable),
|
||||
'table' => $joinTable,
|
||||
'conditions' => array(
|
||||
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
|
||||
'I18n__'.$field.'.model' => $model->name,
|
||||
|
|
|
@ -93,7 +93,7 @@ class AclNode extends AppModel {
|
|||
$db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght")),
|
||||
'fields' => array('id', 'parent_id', 'model', 'foreign_key', 'alias'),
|
||||
'joins' => array(array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}0",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array("{$type}0.alias" => $start)
|
||||
|
@ -105,7 +105,7 @@ class AclNode extends AppModel {
|
|||
$j = $i - 1;
|
||||
|
||||
$queryData['joins'][] = array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}{$i}",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array(
|
||||
|
@ -175,7 +175,7 @@ class AclNode extends AppModel {
|
|||
'conditions' => $ref,
|
||||
'fields' => array('id', 'parent_id', 'model', 'foreign_key', 'alias'),
|
||||
'joins' => array(array(
|
||||
'table' => $db->fullTableName($this),
|
||||
'table' => $table,
|
||||
'alias' => "{$type}0",
|
||||
'type' => 'LEFT',
|
||||
'conditions' => array(
|
||||
|
|
Loading…
Reference in a new issue