Making Model::setSource() eager again to fix issues where joined models

would not have the table prefixes correctly configured.  Fixes #1507
This commit is contained in:
mark_story 2011-02-13 18:42:04 -05:00
parent 7f8c98d9de
commit d20f68c44e

View file

@ -465,16 +465,14 @@ class Model extends Object {
$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);
}