mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-06 08:14:21 +01:00
Implemented test generation for crud command.
This commit is contained in:
@@ -234,29 +234,6 @@ EOD;
|
||||
return $relationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a word to its plural form.
|
||||
* @param string the word to be pluralized
|
||||
* @return string the pluralized word
|
||||
*/
|
||||
public function pluralize($name)
|
||||
{
|
||||
$rules=array(
|
||||
'/(x|ch|ss|sh|us|as|is|os)$/i' => '\1es',
|
||||
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
|
||||
'/(m)an$/i' => '\1en',
|
||||
'/(child)$/i' => '\1ren',
|
||||
'/(r)y$/i' => '\1ies',
|
||||
'/s$/' => 's',
|
||||
);
|
||||
foreach($rules as $rule=>$replacement)
|
||||
{
|
||||
if(preg_match($rule,$name))
|
||||
return preg_replace($rule,$replacement,$name);
|
||||
}
|
||||
return $name.'s';
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the action.
|
||||
* @param array command line parameters specific for this command
|
||||
|
||||
Reference in New Issue
Block a user