Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DQL custom functions on doctrine reference page #3946

Closed
wants to merge 11 commits into from
70 changes: 70 additions & 0 deletions reference/configuration/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,73 @@ 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

Shorten configuration syntax
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put doctrine.orm in literals (double backticks).


.. code-block:: yaml

doctrine:
orm:
# ...
query_cache_driver:
type: array # Required
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think - to avoid duplication (but to keep things clear) we should only show the top-level items (e.g. query_cache_driver, metadata_cache_driver, etc) and put a #... under each if it has child options. So:

query_cache_driver:
    # ...
metadata_cache_driver:
    # ...
result_cache_driver:
    # ...
connection: ~
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory

and then continued for everything else. What do you think about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it will be easier to understand, yes. The shorter, the better in this case.

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:
# 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split the line after the first word that crosses the 72nd character.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] at the same time.


.. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html