I\'m using Symfony 4.3.8 and I can\'t find any information about thoses deprecations :
User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingS
For those who works with symfony4.3 and still want this warning disapear you can add add new new service defintion in service.yaml
custom_doctrine_orm_naming_strategy_underscore:
class: Doctrine\ORM\Mapping\UnderscoreNamingStrategy
arguments:
- 0
- true
and change the configuration of doctrine.yaml like this:
orm:
naming_strategy: custom_doctrine_orm_naming_strategy_underscore
before going straight forward committing this change I would suggest you to verify that passing true
to the Doctrine\ORM\Mapping\UnderscoreNamingStrategy
doesn't affect the expected behavior of your code.
// class UnderscoreNamingStrategy
/**
* Underscore naming strategy construct.
*
* @param int $case CASE_LOWER | CASE_UPPER
*/
public function __construct($case = CASE_LOWER, bool $numberAware = false)
{
if (! $numberAware) {
@trigger_error(
'Creating ' . self::class . ' without making it number aware is deprecated and will be removed in Doctrine ORM 3.0.',
E_USER_DEPRECATED
);
}
$this->case = $case;
$this->pattern = $numberAware ? self::NUMBER_AWARE_PATTERN : self::DEFAULT_PATTERN;
}
Quick hint:
passing true
to the c'tor will make the class use the NUMBER_AWARE_PATTERN
instead of the DEFAULT_PATTERN
private const DEFAULT_PATTERN = '/(?<=[a-z])([A-Z])/';
private const NUMBER_AWARE_PATTERN = '/(?<=[a-z0-9])([A-Z])/';