title: Naming Strategy for table and column names (Doctrine ORM)
body: <p>Is it possible to have a naming strategy take care of mapping table and column names in Doctrine ORM?</p>
  
  <p>Right now all names are specified via annotation in the entity classes, e.g.</p>
  
  <pre><code>&lt;?php
  
  namespace App\Entity;
  
  use DateTimeInterface;
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Entity()
   * @ORM\Table(name="role")
   */
  class Role
  {
      /**
       * @ORM\Id()
       * @ORM\Column(name="id", type="guid")
       * @ORM\GeneratedValue(strategy="NONE")
       * @var string
       */
      private $id;
  
      /**
       * @ORM\Column(name="created_at", type="datetime")
       * @var \DateTimeImmutable
       */
      private $createdAt;
  
      /**
       * @ORM\Column(name="created_by", type="string")
       * @var string
       */
      private $createdBy;
  
      // [..]
  
  }
  </code></pre>
  
  <p>Table and column names are all <code>snake_case</code> while class and property names are all <code>camelCase</code>.</p>
  
  <p>I've tried to remove table and column name declarations in the entity classes and provided a naming strategy` via configuration, trying to set it in the following two ways.</p>
  
  <pre><code>&lt;?php
  
  use Doctrine\ORM\Mapping\UnderscoreNamingStrategy;
  
  return [
      'doctrine' =&gt; [
          'connection' =&gt; [
              // [..]
          ],
          'driver' =&gt; [
              // [..]
          ],
          'annotation' =&gt; [
              // [..]
          ],
          'entity_managers' =&gt; [
              'default' =&gt; [
                  'naming_strategy' =&gt; UnderscoreNamingStrategy::class,
              ],
          ],
          'orm' =&gt; [
              'naming_strategy' =&gt; UnderscoreNamingStrategy::class,
          ],
      ],
  ];
  </code></pre>
  
  <p>When trying to retrieve an entity, an error is thrown.</p>
  
  <pre><code>Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing &amp;#039;SELECT t0.id AS id_1, t0.createdAt AS createdAt_2, t0.createdBy AS createdBy_3, t0.updatedAt AS updatedAt_4, t0.updatedBy AS updatedBy_5, t0.name AS name_6, t0.desc AS desc_7, t0.isCore AS isCore_8 FROM Role t0&amp;#039;:
  
  SQLSTATE[42S22]: Column not found: 1054 Unknown column &amp;#039;t0.createdAt&amp;#039; in &amp;#039;field list&amp;#039; in file C:\project\path\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractMySQLDriver.php on line 60
  </code></pre>