8000 :bug: Inflector::* has been removed in `doctrine/inflector@^2.0` · thecodingmachine/tdbm@60c2c43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 60c2c43

Browse files
committed
🐛 Inflector::* has been removed in doctrine/inflector@^2.0
1 parent 8da64b2 commit 60c2c43

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Utils/PivotTableMethodsDescriptor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace TheCodingMachine\TDBM\Utils;
55

6-
use Doctrine\Common\Inflector\Inflector;
76
use Doctrine\DBAL\Schema\Column;
87
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
98
use Doctrine\DBAL\Schema\Table;
@@ -121,7 +120,7 @@ public function getResultIteratorClassName(): string
121120
private function getPluralName() : string
122121
{
123122
if ($this->isAutoPivot()) {
124-
$name = Inflector::pluralize($this->namingStrategy->getAutoPivotEntityName($this->remoteFk, false));
123+
$name = TDBMDaoGenerator::toPlural($this->namingStrategy->getAutoPivotEntityName($this->remoteFk, false));
125124
if ($this->useAlternateName) {
126125
$name .= 'By_'.$this->pivotTable->getName();
127126
}

src/Utils/TDBMDaoGenerator.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,19 @@ public static function toSingular(string $str): string
477477
return self::$inflector->singularize($str);
478478
}
479479

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+
480493
/**
481494
* Put the first letter of the string in lower case.
482495
* Very useful to transform a class name into a variable name.

0 commit comments

Comments
 (0)
0