From 260c8d0113e8849a490eaec4e77fef97904863ee Mon Sep 17 00:00:00 2001 From: Sven Cannivy Date: Fri, 10 Feb 2017 18:48:57 +0100 Subject: [PATCH] Fix typos and wording in NamingStrategy documentation --- docs/en/reference/namingstrategy.rst | 41 ++++++++++------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/docs/en/reference/namingstrategy.rst b/docs/en/reference/namingstrategy.rst index 9d82d8d8b..9f8e4a599 100644 --- a/docs/en/reference/namingstrategy.rst +++ b/docs/en/reference/namingstrategy.rst @@ -3,21 +3,18 @@ Implementing a NamingStrategy .. versionadded:: 2.3 -Using a naming strategy you can provide rules for automatically generating -database identifiers, columns and tables names -when the table/column name is not given. -This feature helps reduce the verbosity of the mapping document, -eliminating repetitive noise (eg: ``TABLE_``). - +Using a naming strategy you can provide rules for generating database identifiers, +column or table names when the column or table name is not given. This feature helps +reduce the verbosity of the mapping document, eliminating repetitive noise (eg: ``TABLE_``). Configuring a naming strategy ----------------------------- The default strategy used by Doctrine is quite minimal. By default the ``Doctrine\ORM\Mapping\DefaultNamingStrategy`` -uses the simple class name and the attributes names to generate tables and columns +uses the simple class name and the attribute names to generate tables and columns. -You can specify a different strategy by calling ``Doctrine\ORM\Configuration#setNamingStrategy()`` : +You can specify a different strategy by calling ``Doctrine\ORM\Configuration#setNamingStrategy()``: .. code-block:: php @@ -28,8 +25,7 @@ You can specify a different strategy by calling ``Doctrine\ORM\Configuration#set Underscore naming strategy --------------------------- -``\Doctrine\ORM\Mapping\UnderscoreNamingStrategy`` is a built-in strategy -that might be a useful if you want to use a underlying convention. +``\Doctrine\ORM\Mapping\UnderscoreNamingStrategy`` is a built-in strategy. .. code-block:: php @@ -37,14 +33,13 @@ that might be a useful if you want to use a underlying convention. $namingStrategy = new \Doctrine\ORM\Mapping\UnderscoreNamingStrategy(CASE_UPPER); $configuration()->setNamingStrategy($namingStrategy); -Then SomeEntityName will generate the table SOME_ENTITY_NAME when CASE_UPPER -or some_entity_name using CASE_LOWER is given. - +For SomeEntityName the strategy will generate the table SOME_ENTITY_NAME with the +``CASE_UPPER`` option, or some_entity_name with the ``CASE_LOWER`` option. Naming strategy interface ------------------------- The interface ``Doctrine\ORM\Mapping\NamingStrategy`` allows you to specify -a "naming standard" for database tables and columns. +a naming strategy for database tables and columns. .. code-block:: php @@ -101,10 +96,11 @@ a "naming standard" for database tables and columns. Implementing a naming strategy ------------------------------- -If you have database naming standards like all tables names should be prefixed -by the application prefix, all column names should be upper case, -you can easily achieve such standards by implementing a naming strategy. -You need to implements NamingStrategy first. Following is an example +If you have database naming standards, like all table names should be prefixed +by the application prefix, all column names should be upper case, you can easily +achieve such standards by implementing a naming strategy. + +You need to create a class which implements ``Doctrine\ORM\Mapping\NamingStrategy``. .. code-block:: php @@ -139,12 +135,3 @@ You need to implements NamingStrategy first. Following is an example ($referencedColumnName ?: $this->referenceColumnName())); } } - -Configuring the namingstrategy is easy if. -Just set your naming strategy calling ``Doctrine\ORM\Configuration#setNamingStrategy()`` :. - -.. code-block:: php - - setNamingStrategy($namingStrategy);