From d3fb74c8baa4378b2b1b4262bbfec87177279f71 Mon Sep 17 00:00:00 2001 From: Predrag Lukesevic Date: Mon, 20 Mar 2023 14:33:45 +0100 Subject: [PATCH] upgrade doctrine inflector --- Mapping/Caser.php | 15 +++++++++++++-- composer.json | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Mapping/Caser.php b/Mapping/Caser.php index 6a0022ae..2bf533f5 100644 --- a/Mapping/Caser.php +++ b/Mapping/Caser.php @@ -11,13 +11,20 @@ namespace ONGR\ElasticsearchBundle\Mapping; -use Doctrine\Common\Inflector\Inflector; + +use Doctrine\Inflector\Inflector; +use Doctrine\Inflector\InflectorFactory; /** * Utility for string case transformations. */ class Caser { + /** + * @var Inflector|null + */ + private static $inflector; + /** * Transforms string to camel case (e.g., resultString). * @@ -27,7 +34,11 @@ class Caser */ public static function camel($string) { - return Inflector::camelize($string); + if (!self::$inflector) { + self::$inflector = InflectorFactory::create()->build(); + } + + return self::$inflector->camelize($string); } /** diff --git a/composer.json b/composer.json index a6b82589..818f4346 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "symfony/property-access": "^4.4|^5.0", "doctrine/annotations": "^1.6", "doctrine/cache": "^1.7", - "doctrine/inflector": "^1.3", + "doctrine/inflector": "^1.4 | ^2.0", "doctrine/collections": "^1.5", "monolog/monolog": "^1.24", "elasticsearch/elasticsearch": "^7.0|^8.0",