Skip to content

Commit

Permalink
Fix file always being set to 'schema.php'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markstory committed Oct 26, 2013
1 parent 3dc60af commit 411f510
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Cake/Console/Command/SchemaShell.php
Expand Up @@ -67,12 +67,12 @@ public function startup() {
$name = $this->params['name'] = $splitName;
}

if ($name && empty($this->params['file'])) {
$this->params['file'] = Inflector::underscore($name);
}

$defaultFile = 'schema.php';
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) {
$this->params['file'] .= '.php';
Expand Down

0 comments on commit 411f510

Please sign in to comment.