From 2541f863ce80c8ea23e45ad187b14ba57dbcf254 Mon Sep 17 00:00:00 2001 From: healdropper Date: Fri, 13 Jun 2014 14:09:25 +0200 Subject: [PATCH 01/11] DQL custom functions on doctrine reference page Seems that there is two possibilities to configure custom DQL functions It should be clearified in doctrine reference page because It may confuse some people if they just read the cookbook: http://symfony.com/doc/current/cookbook/doctrine/custom_dql_functions.html --- reference/configuration/doctrine.rst | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 9c9b959123a..13b97c56f81 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -411,3 +411,42 @@ Each connection is also accessible via the ``doctrine.dbal.[name]_connection`` service where ``[name]`` is the name of the connection. .. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html + +Register Custom DQL Functions +----------------------------- + +Doctrine allows you to specify custom DQL functions. For more information +on this topic, read Doctrine's cookbook article "`DQL User Defined Functions`_". + +In Symfony, you can register your custom DQL functions as follows: + +.. code-block:: yaml + doctrine: + orm: + # ... + entity_managers: + default: + # ... + dql: + string_functions: + test_string: Acme\HelloBundle\DQL\StringFunction + second_string: Acme\HelloBundle\DQL\SecondStringFunction + numeric_functions: + test_numeric: Acme\HelloBundle\DQL\NumericFunction + datetime_functions: + test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + +However, if you are only using one entity manager, DQL functions can be registed like this: + +.. code-block:: yaml + doctrine: + orm: + # ... + dql: + string_functions: + test_string: Acme\HelloBundle\DQL\StringFunction + second_string: Acme\HelloBundle\DQL\SecondStringFunction + numeric_functions: + test_numeric: Acme\HelloBundle\DQL\NumericFunction + datetime_functions: + test_datetime: Acme\HelloBundle\DQL\DatetimeFunction From b5f9ac022beb3767bbf18f66ec084bd672833c3b Mon Sep 17 00:00:00 2001 From: healdropper Date: Fri, 13 Jun 2014 14:27:59 +0200 Subject: [PATCH 02/11] Update doctrine.rst --- reference/configuration/doctrine.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 13b97c56f81..dd1f7e8f589 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -421,6 +421,7 @@ on this topic, read Doctrine's cookbook article "`DQL User Defined Functions`_". In Symfony, you can register your custom DQL functions as follows: .. code-block:: yaml + doctrine: orm: # ... From 95f53aed33becb0764baaf3ca93ead9c09a4a3db Mon Sep 17 00:00:00 2001 From: healdropper Date: Fri, 13 Jun 2014 14:28:50 +0200 Subject: [PATCH 03/11] Update doctrine.rst --- reference/configuration/doctrine.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index dd1f7e8f589..1810189fa77 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -440,6 +440,7 @@ In Symfony, you can register your custom DQL functions as follows: However, if you are only using one entity manager, DQL functions can be registed like this: .. code-block:: yaml + doctrine: orm: # ... From 98dee12c7f7e27177e426bbf59e148d710cdf1e8 Mon Sep 17 00:00:00 2001 From: healdropper Date: Fri, 13 Jun 2014 14:33:24 +0200 Subject: [PATCH 04/11] Fixed broked link --- reference/configuration/doctrine.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 1810189fa77..ad82d89106f 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -452,3 +452,6 @@ However, if you are only using one entity manager, DQL functions can be registed test_numeric: Acme\HelloBundle\DQL\NumericFunction datetime_functions: test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + + +.. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html From 69efcedb1e0e46348349d2ba91626ff76244a7c5 Mon Sep 17 00:00:00 2001 From: healdropper Date: Mon, 16 Jun 2014 09:46:39 +0200 Subject: [PATCH 05/11] Shorten syntax mention on doctrine reference Changed documentation to explain shorten syntax in general, not just DQL functions part --- reference/configuration/doctrine.rst | 84 ++++++++++++++++++---------- 1 file changed, 55 insertions(+), 29 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index ad82d89106f..907762fe4ab 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -412,46 +412,72 @@ service where ``[name]`` is the name of the connection. .. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html -Register Custom DQL Functions +Shorten configuration syntax ----------------------------- -Doctrine allows you to specify custom DQL functions. For more information -on this topic, read Doctrine's cookbook article "`DQL User Defined Functions`_". - -In Symfony, you can register your custom DQL functions as follows: - -.. code-block:: yaml - - doctrine: - orm: - # ... - entity_managers: - default: - # ... - dql: - string_functions: - test_string: Acme\HelloBundle\DQL\StringFunction - second_string: Acme\HelloBundle\DQL\SecondStringFunction - numeric_functions: - test_numeric: Acme\HelloBundle\DQL\NumericFunction - datetime_functions: - test_datetime: Acme\HelloBundle\DQL\DatetimeFunction - -However, if you are only using one entity manager, DQL functions can be registed like this: +When you are only using one entity manager, all config options available +for each entity manager can be placed directly under doctrine.orm config level. .. code-block:: yaml doctrine: orm: # ... + query_cache_driver: + type: array # Required + host: ~ + port: ~ + instance_class: ~ + class: ~ + metadata_cache_driver: + type: array # Required + host: ~ + port: ~ + instance_class: ~ + class: ~ + result_cache_driver: + type: array # Required + host: ~ + port: ~ + instance_class: ~ + class: ~ + connection: ~ + class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory + default_repository_class: Doctrine\ORM\EntityRepository + auto_mapping: false + hydrators: + # An array of hydrator names + hydrator_name: [] + mappings: + # An array of mappings, which may be a bundle name or something else + mapping_name: + mapping: true + type: ~ + dir: ~ + alias: ~ + prefix: ~ + is_bundle: ~ dql: + # a collection of string functions string_functions: - test_string: Acme\HelloBundle\DQL\StringFunction - second_string: Acme\HelloBundle\DQL\SecondStringFunction + # example + # test_string: Acme\HelloBundle\DQL\StringFunction + + # a collection of numeric functions numeric_functions: - test_numeric: Acme\HelloBundle\DQL\NumericFunction - datetime_functions: - test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + # example + # test_numeric: Acme\HelloBundle\DQL\NumericFunction + # a collection of datetime functions + datetime_functions: + # example + # test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + filters: + # An array of filters + some_filter: + class: ~ # Required + enabled: false + +This shorten version is commonly used in other documentation sections. Keep in mind that you can't use both syntax at same time. .. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html From 4a046fafb50290688a075537e3945a63eac2f3da Mon Sep 17 00:00:00 2001 From: healdropper Date: Sat, 21 Jun 2014 09:31:37 +0200 Subject: [PATCH 06/11] Update doctrine.rst Made more clear the shorten doctrine.yml syntax, leaving only the first level of configuration. --- reference/configuration/doctrine.rst | 54 +++++----------------------- 1 file changed, 9 insertions(+), 45 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 907762fe4ab..d031672cd7d 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -424,59 +424,23 @@ for each entity manager can be placed directly under doctrine.orm config level. orm: # ... query_cache_driver: - type: array # Required - host: ~ - port: ~ - instance_class: ~ - class: ~ + # ... metadata_cache_driver: - type: array # Required - host: ~ - port: ~ - instance_class: ~ - class: ~ + # ... result_cache_driver: - type: array # Required - host: ~ - port: ~ - instance_class: ~ - class: ~ - connection: ~ + # ... + connection: ~ class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory default_repository_class: Doctrine\ORM\EntityRepository - auto_mapping: false + auto_mapping: false hydrators: - # An array of hydrator names - hydrator_name: [] + # ... mappings: - # An array of mappings, which may be a bundle name or something else - mapping_name: - mapping: true - type: ~ - dir: ~ - alias: ~ - prefix: ~ - is_bundle: ~ + # ... dql: - # a collection of string functions - string_functions: - # example - # test_string: Acme\HelloBundle\DQL\StringFunction - - # a collection of numeric functions - numeric_functions: - # example - # test_numeric: Acme\HelloBundle\DQL\NumericFunction - - # a collection of datetime functions - datetime_functions: - # example - # test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + # ... filters: - # An array of filters - some_filter: - class: ~ # Required - enabled: false + # ... This shorten version is commonly used in other documentation sections. Keep in mind that you can't use both syntax at same time. From 1ce3fcce7d4dc23ee969bbc93c4110f2c632b3f1 Mon Sep 17 00:00:00 2001 From: healdropper Date: Sun, 22 Jun 2014 16:49:27 +0200 Subject: [PATCH 07/11] Update doctrine.rst Proposed changes to format --- reference/configuration/doctrine.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index d031672cd7d..abe7d47564b 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -415,8 +415,9 @@ service where ``[name]`` is the name of the connection. Shorten configuration syntax ----------------------------- -When you are only using one entity manager, all config options available -for each entity manager can be placed directly under doctrine.orm config level. +When you are only using one entity manager, all config options available +for each entity manager can be placed directly under ``doctrine.orm`` config +level. .. code-block:: yaml @@ -442,6 +443,7 @@ for each entity manager can be placed directly under doctrine.orm config level. filters: # ... -This shorten version is commonly used in other documentation sections. Keep in mind that you can't use both syntax at same time. +This shorten version is commonly used in other documentation sections. +Keep in mind that you can't use both syntax at the same time. .. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html From 044e1eb149ba43c8e1da5a2fad813fa0bf52c90b Mon Sep 17 00:00:00 2001 From: healdropper Date: Sat, 28 Jun 2014 10:54:57 +0200 Subject: [PATCH 08/11] Update doctrine.rst Minor typos changes --- reference/configuration/doctrine.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index abe7d47564b..14715b8a687 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -443,7 +443,7 @@ level. filters: # ... -This shorten version is commonly used in other documentation sections. -Keep in mind that you can't use both syntax at the same time. +This shortened version is commonly used in other documentation sections. +Keep in mind that you can't use both syntaxes at the same time. .. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html From 9536c174e01cd39d44db728380af9f0f1ca8de6d Mon Sep 17 00:00:00 2001 From: healdropper Date: Sat, 28 Jun 2014 10:57:50 +0200 Subject: [PATCH 09/11] Update doctrine.rst More typos oops :P --- reference/configuration/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 14715b8a687..9c58a0fa2ef 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -412,7 +412,7 @@ service where ``[name]`` is the name of the connection. .. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html -Shorten configuration syntax +Shortened Configuration syntax ----------------------------- When you are only using one entity manager, all config options available From b4f3151990b43b5632c4e0a633767e134a72bd59 Mon Sep 17 00:00:00 2001 From: healdropper Date: Sat, 28 Jun 2014 11:08:26 +0200 Subject: [PATCH 10/11] Update doctrine.rst Fix for "Title underline too short" --- reference/configuration/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 9c58a0fa2ef..b5e0d72ca98 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -413,7 +413,7 @@ service where ``[name]`` is the name of the connection. .. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html Shortened Configuration syntax ------------------------------ +------------------------------ When you are only using one entity manager, all config options available for each entity manager can be placed directly under ``doctrine.orm`` config From 39957c57e9047588793e75a02b926d70866e9a28 Mon Sep 17 00:00:00 2001 From: healdropper Date: Mon, 30 Jun 2014 12:25:56 +0200 Subject: [PATCH 11/11] Update doctrine.rst Included more suggestions --- reference/configuration/doctrine.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index b5e0d72ca98..d1a25c75a39 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -412,12 +412,11 @@ service where ``[name]`` is the name of the connection. .. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html -Shortened Configuration syntax +Shortened Configuration Syntax ------------------------------ When you are only using one entity manager, all config options available -for each entity manager can be placed directly under ``doctrine.orm`` config -level. +can be placed directly under ``doctrine.orm`` config level. .. code-block:: yaml