Skip to content

Commit

Permalink
Remove singularization on schema class names.
Browse files Browse the repository at this point in the history
Using camelize() does the transformation we want without also
singularizing the name. This makes user input more transparent and fixes
issues around plugin schemas with plural names.

Refs #4993
  • Loading branch information
markstory committed Nov 10, 2014
1 parent 9ce3d89 commit 7718d47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/SchemaShell.php
Expand Up @@ -89,7 +89,7 @@ public function startup() {
$name = $plugin;
}
}
$name = Inflector::classify($name);
$name = Inflector::camelize($name);
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
}

Expand Down
12 changes: 6 additions & 6 deletions lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
Expand Up @@ -617,19 +617,19 @@ public function testName() {
$this->Shell->params = array(
'plugin' => 'TestPlugin',
'connection' => 'test',
'name' => 'custom_name',
'name' => 'custom_names',
'force' => false,
'overwrite' => true,
);
$this->Shell->startup();
if (file_exists($this->Shell->Schema->path . DS . 'custom_name.php')) {
unlink($this->Shell->Schema->path . DS . 'custom_name.php');
if (file_exists($this->Shell->Schema->path . DS . 'custom_names.php')) {
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
}
$this->Shell->generate();

$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_name.php');
$this->assertRegExp('/class CustomNameSchema/', $contents);
unlink($this->Shell->Schema->path . DS . 'custom_name.php');
$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php');
$this->assertRegExp('/class CustomNamesSchema/', $contents);
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
CakePlugin::unload();
}

Expand Down

0 comments on commit 7718d47

Please sign in to comment.