Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doctrine/inflector deprecations and allow to install v2 #963

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Mapping/Caser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@

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).
*
Expand All @@ -27,7 +33,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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^6.0",
Expand Down