Skip to content

Commit

Permalink
Making Model::setSource() eager again to fix issues where joined models
Browse files Browse the repository at this point in the history
would not have the table prefixes correctly configured.  Fixes #1507
  • Loading branch information
markstory committed Feb 13, 2011
1 parent 7f8c98d commit d20f68c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cake/libs/model/model.php
Expand Up @@ -465,16 +465,14 @@ function __construct($id = false, $table = null, $ds = null) {
$this->Behaviors = new BehaviorCollection();

if ($this->useTable !== false) {

if ($this->useTable === null) {
$this->useTable = Inflector::tableize($this->name);
}
$this->setSource($this->useTable);

if ($this->displayField == null) {
unset($this->displayField);
}
$this->table = $this->useTable;
$this->tableToModel[$this->table] = $this->alias;
} elseif ($this->table === false) {
$this->table = Inflector::tableize($this->name);
}
Expand Down

0 comments on commit d20f68c

Please sign in to comment.