Skip to content

Commit 043a7ec

Browse files
committed
Fix doctrine/inflector deprecations and allow to install v2
1 parent ac771ff commit 043a7ec

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Mapping/Caser.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@
1111

1212
namespace ONGR\ElasticsearchBundle\Mapping;
1313

14-
use Doctrine\Common\Inflector\Inflector;
14+
use Doctrine\Inflector\Inflector;
15+
use Doctrine\Inflector\InflectorFactory;
1516

1617
/**
1718
* Utility for string case transformations.
1819
*/
1920
class Caser
2021
{
22+
/**
23+
* @var Inflector|null
24+
*/
25+
private static $inflector;
26+
2127
/**
2228
* Transforms string to camel case (e.g., resultString).
2329
*
@@ -27,7 +33,11 @@ class Caser
2733
*/
2834
public static function camel($string)
2935
{
30-
return Inflector::camelize($string);
36+
if (!self::$inflector) {
37+
self::$inflector = InflectorFactory::create()->build();
38+
}
39+
40+
return self::$inflector->camelize($string);
3141
}
3242

3343
/**

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"symfony/property-access": "^4.4|^5.0",
2323
"doctrine/annotations": "^1.6",
2424
"doctrine/cache": "^1.7",
25-
"doctrine/inflector": "^1.3",
25+
"doctrine/inflector": "^1.4 || ^2.0",
2626
"doctrine/collections": "^1.5",
2727
"monolog/monolog": "^1.24",
2828
"elasticsearch/elasticsearch": "^6.0",

0 commit comments

Comments
 (0)