Skip to content

Commit 7dd29c0

Browse files
committed
- migration to fresh Doctrine/Inflector API
1 parent bdb0183 commit 7dd29c0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/Entities.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ final class Entities implements GeneratorInterface
4545
/** @var int */
4646
private $tableNaming;
4747

48+
/** @var \Doctrine\Inflector\Inflector */
49+
private $inflector;
50+
4851
/**
4952
* @param ClassesInterface $locator
5053
* @param AnnotationReader|null $reader
@@ -59,6 +62,7 @@ public function __construct(
5962
$this->reader = $reader ?? new AnnotationReader();
6063
$this->generator = new Configurator($this->reader);
6164
$this->tableNaming = $tableNaming;
65+
$this->inflector = (new \Doctrine\Inflector\Rules\English\InflectorFactory())->build();
6266
}
6367

6468
/**
@@ -188,14 +192,14 @@ protected function resolveTarget(Registry $registry, string $name): ?string
188192
*/
189193
protected function tableName(string $role): string
190194
{
191-
$table = Inflector::tableize($role);
195+
$table = $this->inflector->tableize($role);
192196

193197
switch ($this->tableNaming) {
194198
case self::TABLE_NAMING_PLURAL:
195-
return Inflector::pluralize(Inflector::tableize($role));
199+
return $this->inflector->pluralize($this->inflector->tableize($role));
196200

197201
case self::TABLE_NAMING_SINGULAR:
198-
return Inflector::singularize(Inflector::tableize($role));
202+
return $this->inflector->singularize($this->inflector->tableize($role));
199203

200204
default:
201205
return $table;

0 commit comments

Comments
 (0)