From eeb27677208f019aa1afd1900fb63d08823f169e Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Thu, 16 Nov 2023 12:59:45 +0100 Subject: [PATCH] [Doctrine] Suggest reusable bundles use explicit `name` configurations for Doctrine entities --- bundles/best_practices.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index 26915bdea9b..a334af6724e 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -167,6 +167,13 @@ recommended to define their mapping using XML files stored in :doc:`standard Symfony mechanism to override bundle parts `. This is not possible when using annotations/attributes to define the mapping. +Also, include explicit ``name`` values in the configuration for database tables +and columns, to make sure your code is independent of the Doctrine naming strategy +in use. Otherwise, for example when referring to columns in plain SQL queries, +using different naming strategies may break your code. This may mean that the +database schema elements belonging to your bundle follow another convention than +the rest of the project. + .. caution:: The recommended bundle structure was changed in Symfony 5, read the