File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
namespace TheCodingMachine \TDBM \Utils ;
5
5
6
- use Doctrine \Common \Inflector \Inflector ;
7
6
use Doctrine \DBAL \Schema \Column ;
8
7
use Doctrine \DBAL \Schema \ForeignKeyConstraint ;
9
8
use Doctrine \DBAL \Schema \Table ;
@@ -121,7 +120,7 @@ public function getResultIteratorClassName(): string
121
120
private function getPluralName () : string
122
121
{
123
122
if ($ this ->isAutoPivot ()) {
124
- $ name = Inflector:: pluralize ($ this ->namingStrategy ->getAutoPivotEntityName ($ this ->remoteFk , false ));
123
+ $ name = TDBMDaoGenerator:: toPlural ($ this ->namingStrategy ->getAutoPivotEntityName ($ this ->remoteFk , false ));
125
124
if ($ this ->useAlternateName ) {
126
125
$ name .= 'By_ ' .$ this ->pivotTable ->getName ();
127
126
}
Original file line number Diff line number Diff line change @@ -477,6 +477,19 @@ public static function toSingular(string $str): string
477
477
return self ::$ inflector ->singularize ($ str );
478
478
}
479
479
480
+ /**
481
+ * Tries to put string to the plural form (if it is singular).
482
+ * We assume the string is in english.
483
+ */
484
+ public static function toPlural (string $ str ): string
485
+ {
486
+ if (self ::$ inflector === null ) {
487
+ self ::$ inflector = InflectorFactory::create ()->build ();
488
+ }
489
+
490
+ return self ::$ inflector ->pluralize ($ str );
491
+ }
492
+
480
493
/**
481
494
* Put the first letter of the string in lower case.
482
495
* Very useful to transform a class name into a variable name.
You can’t perform that action at this time.
0 commit comments