mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 02:22:39 +00:00
updating model constructor in 1.1, 1.2 to use the $table param
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5067 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5d7ce86000
commit
51e78eac9f
1 changed files with 12 additions and 11 deletions
|
@ -365,26 +365,27 @@ class Model extends Overloadable {
|
|||
|
||||
ClassRegistry::addObject($this->currentModel, $this);
|
||||
ClassRegistry::map($this->currentModel, $this->currentModel);
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
|
||||
if($table === false) {
|
||||
$this->useTable = false;
|
||||
} else if($table) {
|
||||
$this->useTable = $table;
|
||||
}
|
||||
|
||||
if ($this->useTable !== false) {
|
||||
$this->setDataSource($ds);
|
||||
|
||||
if ($table) {
|
||||
$tableName = $table;
|
||||
} else {
|
||||
if ($this->useTable) {
|
||||
$tableName = $this->useTable;
|
||||
} else {
|
||||
$tableName = Inflector::tableize($this->name);
|
||||
}
|
||||
|
||||
if ($this->useTable === null) {
|
||||
$this->useTable = Inflector::tableize($this->name);
|
||||
}
|
||||
|
||||
if (in_array('settableprefix', get_class_methods($this))) {
|
||||
$this->setTablePrefix();
|
||||
}
|
||||
|
||||
$this->setSource($tableName);
|
||||
$this->setSource($this->useTable);
|
||||
$this->__createLinks();
|
||||
|
||||
if ($this->displayField == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue