示例#1
0
 public function Pluralize($word)
 {
     // Handle special cases
     if (array_key_exists($word, $this->NonRegularWord)) {
         return $this->NonRegularWord[$word];
     } else {
         if ($this->EndWithOr($word, array('ch', 'x', 's'))) {
             return $word . 'es';
         } else {
             if ($this->EndWithOr($word, array('o'))) {
                 return $word . 'es';
             } else {
                 if ($this->EndWithOr($word, array('f', 'fe'))) {
                     return replaceLastOccurence($word, 'f', 'v') . 'es';
                 } else {
                     if ($this->EndWithOr($word, array('y'))) {
                         return replaceLastOccurence($word, 'y', 'ies');
                     } else {
                         if ($this->EndWithOr($word, array('ix'))) {
                             return replaceLastOccurence($word, 'ix', 'ices');
                         } else {
                             return $word . 's';
                         }
                     }
                 }
             }
         }
     }
 }
示例#2
0
 protected function CreateReferenceName($columnName)
 {
     if (endsWith($columnName, 'Id')) {
         return replaceLastOccurence($columnName, 'Id', '');
     } else {
         if (endsWith($columnName, '_id')) {
             return replaceLastOccurence($columnName, '_id', '');
         } else {
             return $columnName + 'Object';
         }
     }
 }