/** !Route GET, model/gen/analyzeModelName/$modelName */ public function analyzeModelName($modelName) { Library::import('recess.lang.Inflector'); $this->tableName = Inflector::toPlural(Inflector::toUnderscores($modelName)); $this->isValid = preg_match('/^[a-zA-Z][_a-zA-z0-9]*$/', $modelName) == 1; }
function testToPlural() { $this->assertEquals('things', Inflector::toPlural('thing')); $this->assertEquals('persons', Inflector::toPlural('person')); $this->assertEquals('oxs', Inflector::toPlural('ox')); }