Skip to content

Commit

Permalink
Fixing lazy loading of database conenction when using prefixes and pe…
Browse files Browse the repository at this point in the history
…rforming delete operations
  • Loading branch information
lorenzo committed Feb 23, 2011
1 parent fc060b5 commit 8f62d01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo_source.php
Expand Up @@ -1852,7 +1852,7 @@ protected function _getJoins($model) {
$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}),
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/model.php
Expand Up @@ -1882,7 +1882,7 @@ function delete($id = null, $cascade = true) {
if (!$filters || !$this->exists()) {
return false;
}
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db = $this->getDataSource();

$this->_deleteDependent($id, $cascade);
$this->_deleteLinks($id);
Expand Down

0 comments on commit 8f62d01

Please sign in to comment.