adrenalinkin / doctrine-naming-strategy
Camel Case Doctrine ORM naming strategy
Installs: 103 315
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: ^8.0
- doctrine/orm: ^2.8 || ^3.0
- symfony/deprecation-contracts: ^2.1 || ^3.0
Requires (Dev)
- doctrine/doctrine-bundle: ^2.4
- phpunit/phpunit: ^8.5 || ^9.0 || ^10.0
- symfony/browser-kit: ^5.4 || ^6.0 || ^7.0
- symfony/framework-bundle: ^5.4 || ^6.0 || ^7.0
README
Introduction
Component contains Doctrine CamelCase
naming strategy.
Installation
Open a command console, enter your project directory and execute the following command to download the latest stable version of this component:
composer require adrenalinkin/doctrine-naming-strategy
This command requires you to have Composer install globally.
Usage
For registration new naming strategy you should use manual from the official Doctrine documentation Implementing a NamingStrategy.
<?php declare(strict_types=1); $namingStrategy = new \Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy(); /** @var \Doctrine\ORM\Configuration $configuration */ $configuration->setNamingStrategy($namingStrategy);
In that case, when you use Doctrine as part of the Symfony Framework - you should look into appropriated part of the
DoctrineBundle
documentation:
Configuration Reference.
# Register CamelCaseNamingStrategy as service services: Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy: class: Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy doctrine: orm: naming_strategy: Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy
How will the generated SQL change?
To demonstrate difference let's take association example entities from the official Doctrine documentation