mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing lazy loading of database conenction when using prefixes and performing delete operations
This commit is contained in:
parent
fc060b5e9c
commit
8f62d01701
2 changed files with 2 additions and 2 deletions
|
@ -1852,7 +1852,7 @@ class DboSource extends DataSource {
|
|||
$joins = array_merge($model->getAssociated('hasOne'), $model->getAssociated('belongsTo'));
|
||||
|
||||
foreach ($joins as $assoc) {
|
||||
if (isset($model->{$assoc}) && $model->useDbConfig == $model->{$assoc}->useDbConfig) {
|
||||
if (isset($model->{$assoc}) && $model->useDbConfig == $model->{$assoc}->useDbConfig && $model->{$assoc}->getDataSource()) {
|
||||
$assocData = $model->getAssociated($assoc);
|
||||
$join[] = $this->buildJoinStatement(array(
|
||||
'table' => $this->fullTableName($model->{$assoc}),
|
||||
|
|
|
@ -1882,7 +1882,7 @@ class Model extends Object {
|
|||
if (!$filters || !$this->exists()) {
|
||||
return false;
|
||||
}
|
||||
$db = ConnectionManager::getDataSource($this->useDbConfig);
|
||||
$db = $this->getDataSource();
|
||||
|
||||
$this->_deleteDependent($id, $cascade);
|
||||
$this->_deleteLinks($id);
|
||||
|
|
Loading…
Reference in a new issue