Skip to content

Commit

Permalink
Added singular option to not pluralize scaffolding.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Nov 3, 2012
1 parent 0e71310 commit 8d24110
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/generate.php
Expand Up @@ -235,7 +235,7 @@ public static function model($args, $build = true)
throw new Exception('No fields have been provided, the model will not know how to build the table.');
}

$plural = \Inflector::pluralize($singular);
$plural = \Clio::option('singular') ? $singular : \Inflector::pluralize($singular);

$filename = trim(str_replace(array('_', '-'), DS, $singular), DS);

Expand Down
3 changes: 2 additions & 1 deletion classes/generate/scaffold.php
Expand Up @@ -102,7 +102,8 @@ public static function forge($args, $subfolder)
// If a folder is used, the entity is the last part
$name_parts = explode(DS, $name);
$data['singular_name'] = \Inflector::singularize(end($name_parts));
$data['plural_name'] = \Inflector::pluralize($data['singular_name']);
$data['plural_name'] = \Cli::option('singular')? $data['singular_name'] : \Inflector::pluralize($data['plural_name']);

$data['table'] = \Inflector::tableize($model_name);
$data['controller_parent'] = static::$controller_parent;

Expand Down

2 comments on commit 8d24110

@frankdejonge
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks for spotting it.

@WanWizard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has been fixed, and backported to 1.4.

Please sign in to comment.