项目作者: adrenalinkin

项目描述 :
Doctrine Camel Case naming strategy
高级语言: PHP
项目地址: git://github.com/adrenalinkin/doctrine-naming-strategy.git
创建时间: 2018-09-10T21:03:53Z
项目社区:https://github.com/adrenalinkin/doctrine-naming-strategy

开源协议:MIT License

下载


Doctrine Naming Strategy На Русском

PHPUnit
Coverage Status
Latest Stable Version
Total Downloads

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:

  1. 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.

  1. <?php declare(strict_types=1);
  2. $namingStrategy = new \Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy();
  3. /** @var \Doctrine\ORM\Configuration $configuration */
  4. $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.

  1. # Register CamelCaseNamingStrategy as service
  2. services:
  3. Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy:
  4. class: Linkin\Component\DoctrineNamingStrategy\ORM\Mapping\CamelCaseNamingStrategy
  5. doctrine:
  6. orm:
  7. 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

Compare DefaultNamingStrategy and CamelCaseNamingStrategy

Compare

Raw SQL for different strategies

License

license