Permalink
Browse files

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
  • Loading branch information...
markstory committed Oct 26, 2013
1 parent 3dc60af commit 411f5104068ba4212ff9149ea9720fe1cd8041df
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/Cake/Console/Command/SchemaShell.php
@@ -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';

0 comments on commit 411f510

Please sign in to comment.