mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Overwrite the schemaName property if it is not defined in the class.
If a model class does not define a schemaName we should use the datasource's schemaName. We can assume that people using schemaName want to lock the model onto a specific schema given the changes in #3210 Fixes #3720
This commit is contained in:
parent
fb15fb6001
commit
765be87d88
1 changed files with 6 additions and 1 deletions
|
@ -3490,7 +3490,12 @@ class Model extends Object implements CakeEventListener {
|
|||
$this->tablePrefix = $db->config['prefix'];
|
||||
}
|
||||
|
||||
$this->schemaName = (empty($this->schemaName) ? $db->getSchemaName() : $this->schemaName);
|
||||
$schema = $db->getSchemaName();
|
||||
$defaultProperties = get_class_vars(get_class($this));
|
||||
if (isset($defaultProperties['schemaName'])) {
|
||||
$schema = $defaultProperties['schemaName'];
|
||||
}
|
||||
$this->schemaName = $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue