Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a498d2

Browse files
healdropperweaverryan
authored andcommitted
Shorten syntax mention on doctrine reference
Changed documentation to explain shorten syntax in general, not just DQL functions part
1 parent 873e940 commit 3a498d2

File tree

1 file changed

+55
-29
lines changed

1 file changed

+55
-29
lines changed

reference/configuration/doctrine.rst

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -412,46 +412,72 @@ service where ``[name]`` is the name of the connection.
412412

413413
.. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
414414

415-
Register Custom DQL Functions
415+
Shorten configuration syntax
416416
-----------------------------
417417

418-
Doctrine allows you to specify custom DQL functions. For more information
419-
on this topic, read Doctrine's cookbook article "`DQL User Defined Functions`_".
420-
421-
In Symfony, you can register your custom DQL functions as follows:
422-
423-
.. code-block:: yaml
424-
425-
doctrine:
426-
orm:
427-
# ...
428-
entity_managers:
429-
default:
430-
# ...
431-
dql:
432-
string_functions:
433-
test_string: Acme\HelloBundle\DQL\StringFunction
434-
second_string: Acme\HelloBundle\DQL\SecondStringFunction
435-
numeric_functions:
436-
test_numeric: Acme\HelloBundle\DQL\NumericFunction
437-
datetime_functions:
438-
test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
439-
440-
However, if you are only using one entity manager, DQL functions can be registed like this:
418+
When you are only using one entity manager, all config options available
419+
for each entity manager can be placed directly under doctrine.orm config level.
441420

442421
.. code-block:: yaml
443422
444423
doctrine:
445424
orm:
446425
# ...
426+
query_cache_driver:
427+
type: array # Required
428+
host: ~
429+
port: ~
430+
instance_class: ~
431+
class: ~
432+
metadata_cache_driver:
433+
type: array # Required
434+
host: ~
435+
port: ~
436+
instance_class: ~
437+
class: ~
438+
result_cache_driver:
439+
type: array # Required
440+
host: ~
441+
port: ~
442+
instance_class: ~
443+
class: ~
444+
connection: ~
445+
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
446+
default_repository_class: Doctrine\ORM\EntityRepository
447+
auto_mapping: false
448+
hydrators:
449+
# An array of hydrator names
450+
hydrator_name: []
451+
mappings:
452+
# An array of mappings, which may be a bundle name or something else
453+
mapping_name:
454+
mapping: true
455+
type: ~
456+
dir: ~
457+
alias: ~
458+
prefix: ~
459+
is_bundle: ~
447460
dql:
461+
# a collection of string functions
448462
string_functions:
449-
test_string: Acme\HelloBundle\DQL\StringFunction
450-
second_string: Acme\HelloBundle\DQL\SecondStringFunction
463+
# example
464+
# test_string: Acme\HelloBundle\DQL\StringFunction
465+
466+
# a collection of numeric functions
451467
numeric_functions:
452-
test_numeric: Acme\HelloBundle\DQL\NumericFunction
453-
datetime_functions:
454-
test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
468+
# example
469+
# test_numeric: Acme\HelloBundle\DQL\NumericFunction
455470
471+
# a collection of datetime functions
472+
datetime_functions:
473+
# example
474+
# test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
475+
filters:
476+
# An array of filters
477+
some_filter:
478+
class: ~ # Required
479+
enabled: false
480+
481+
This shorten version is commonly used in other documentation sections. Keep in mind that you can't use both syntax at same time.
456482

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

0 commit comments

Comments
 (0)