mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix file always being set to 'schema.php'
When the name parameter is set and no custom file value is provided, the name should be used to generate the file name. empty() cannot be used because the file parameter has a default value of 'schema.php'. Fixes #2202
This commit is contained in:
parent
3dc60af166
commit
411f510406
1 changed files with 5 additions and 5 deletions
|
@ -67,12 +67,12 @@ class SchemaShell extends AppShell {
|
||||||
$name = $this->params['name'] = $splitName;
|
$name = $this->params['name'] = $splitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($name && empty($this->params['file'])) {
|
$defaultFile = 'schema.php';
|
||||||
$this->params['file'] = Inflector::underscore($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($this->params['file'])) {
|
if (empty($this->params['file'])) {
|
||||||
$this->params['file'] = 'schema.php';
|
$this->params['file'] = $defaultFile;
|
||||||
|
}
|
||||||
|
if ($name && $this->params['file'] === $defaultFile) {
|
||||||
|
$this->params['file'] = Inflector::underscore($name);
|
||||||
}
|
}
|
||||||
if (strpos($this->params['file'], '.php') === false) {
|
if (strpos($this->params['file'], '.php') === false) {
|
||||||
$this->params['file'] .= '.php';
|
$this->params['file'] .= '.php';
|
||||||
|
|
Loading…
Reference in a new issue