Skip to content

Commit be7764b

Browse files
committed
Merge branch '2.8' into 3.3
* 2.8: Reorder DoctrineBundle configuration sections
2 parents 19ec483 + 4d40e3d commit be7764b

File tree

1 file changed

+98
-124
lines changed

1 file changed

+98
-124
lines changed

reference/configuration/doctrine.rst

Lines changed: 98 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -270,102 +270,6 @@ Full Default Configuration
270270
</doctrine:config>
271271
</container>
272272
273-
Configuration Overview
274-
----------------------
275-
276-
This following configuration example shows all the configuration defaults
277-
that the ORM resolves to:
278-
279-
.. code-block:: yaml
280-
281-
doctrine:
282-
orm:
283-
auto_mapping: true
284-
# the standard distribution overrides this to be true in debug, false otherwise
285-
auto_generate_proxy_classes: false
286-
proxy_namespace: Proxies
287-
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
288-
default_entity_manager: default
289-
metadata_cache_driver: array
290-
query_cache_driver: array
291-
result_cache_driver: array
292-
293-
There are lots of other configuration options that you can use to overwrite
294-
certain classes, but those are for very advanced use-cases only.
295-
296-
Caching Drivers
297-
~~~~~~~~~~~~~~~
298-
299-
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
300-
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
301-
There is a special type called ``service`` which lets you define the ID of your
302-
own caching service.
303-
304-
The following example shows an overview of the caching configurations:
305-
306-
.. code-block:: yaml
307-
308-
doctrine:
309-
orm:
310-
auto_mapping: true
311-
# each caching driver type defines its own config options
312-
metadata_cache_driver: apc
313-
result_cache_driver:
314-
type: memcache
315-
host: localhost
316-
port: 11211
317-
instance_class: Memcache
318-
# the 'service' type requires to define the 'id' option too
319-
query_cache_driver:
320-
type: service
321-
id: my_doctrine_common_cache_service
322-
323-
Mapping Configuration
324-
~~~~~~~~~~~~~~~~~~~~~
325-
326-
Explicit definition of all the mapped entities is the only necessary
327-
configuration for the ORM and there are several configuration options that
328-
you can control. The following configuration options exist for a mapping:
329-
330-
type
331-
....
332-
333-
One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``. This
334-
specifies which type of metadata type your mapping uses.
335-
336-
dir
337-
...
338-
339-
Path to the mapping or entity files (depending on the driver). If this path
340-
is relative it is assumed to be relative to the bundle root. This only works
341-
if the name of your mapping is a bundle name. If you want to use this option
342-
to specify absolute paths you should prefix the path with the kernel parameters
343-
that exist in the DIC (for example ``%kernel.project_dir%``).
344-
345-
prefix
346-
......
347-
348-
A common namespace prefix that all entities of this mapping share. This
349-
prefix should never conflict with prefixes of other defined mappings otherwise
350-
some of your entities cannot be found by Doctrine. This option defaults
351-
to the bundle namespace + ``Entity``, for example for an application bundle
352-
called AcmeHelloBundle prefix would be ``Acme\HelloBundle\Entity``.
353-
354-
alias
355-
.....
356-
357-
Doctrine offers a way to alias entity namespaces to simpler, shorter names
358-
to be used in DQL queries or for Repository access. When using a bundle
359-
the alias defaults to the bundle name.
360-
361-
is_bundle
362-
.........
363-
364-
This option is a derived value from ``dir`` and by default is set to ``true``
365-
if dir is relative proved by a ``file_exists()`` check that returns ``false``.
366-
It is ``false`` if the existence check returns ``true``. In this case an
367-
absolute path was specified and the metadata files are most likely in a
368-
directory outside of a bundle.
369273
370274
.. index::
371275
single: Configuration; Doctrine DBAL
@@ -492,41 +396,111 @@ service where ``[name]`` is the name of the connection.
492396

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

495-
Shortened Configuration Syntax
496-
------------------------------
399+
Doctrine ORM Configuration
400+
--------------------------
497401

498-
When you are only using one entity manager, all config options available
499-
can be placed directly under ``doctrine.orm`` config level.
402+
This following configuration example shows all the configuration defaults
403+
that the ORM resolves to:
500404

501405
.. code-block:: yaml
502406
503407
doctrine:
504408
orm:
505-
# ...
506-
query_cache_driver:
507-
# ...
508-
metadata_cache_driver:
509-
# ...
409+
auto_mapping: true
410+
# the standard distribution overrides this to be true in debug, false otherwise
411+
auto_generate_proxy_classes: false
412+
proxy_namespace: Proxies
413+
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
414+
default_entity_manager: default
415+
metadata_cache_driver: array
416+
query_cache_driver: array
417+
result_cache_driver: array
418+
419+
There are lots of other configuration options that you can use to overwrite
420+
certain classes, but those are for very advanced use-cases only.
421+
422+
Caching Drivers
423+
~~~~~~~~~~~~~~~
424+
425+
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
426+
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
427+
There is a special type called ``service`` which lets you define the ID of your
428+
own caching service.
429+
430+
The following example shows an overview of the caching configurations:
431+
432+
.. code-block:: yaml
433+
434+
doctrine:
435+
orm:
436+
auto_mapping: true
437+
# each caching driver type defines its own config options
438+
metadata_cache_driver: apc
510439
result_cache_driver:
511-
# ...
512-
connection: ~
513-
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
514-
default_repository_class: Doctrine\ORM\EntityRepository
515-
auto_mapping: false
516-
hydrators:
517-
# ...
518-
mappings:
519-
# ...
520-
dql:
521-
# ...
522-
filters:
523-
# ...
440+
type: memcache
441+
host: localhost
442+
port: 11211
443+
instance_class: Memcache
444+
# the 'service' type requires to define the 'id' option too
445+
query_cache_driver:
446+
type: service
447+
id: my_doctrine_common_cache_service
448+
449+
Mapping Configuration
450+
~~~~~~~~~~~~~~~~~~~~~
524451

525-
This shortened version is commonly used in other documentation sections.
526-
Keep in mind that you can't use both syntaxes at the same time.
452+
Explicit definition of all the mapped entities is the only necessary
453+
configuration for the ORM and there are several configuration options that
454+
you can control. The following configuration options exist for a mapping:
455+
456+
type
457+
....
458+
459+
One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``. This
460+
specifies which type of metadata type your mapping uses.
461+
462+
dir
463+
...
464+
465+
Path to the mapping or entity files (depending on the driver). If this path
466+
is relative it is assumed to be relative to the bundle root. This only works
467+
if the name of your mapping is a bundle name. If you want to use this option
468+
to specify absolute paths you should prefix the path with the kernel parameters
469+
that exist in the DIC (for example ``%kernel.project_dir%``).
470+
471+
prefix
472+
......
473+
474+
A common namespace prefix that all entities of this mapping share. This
475+
prefix should never conflict with prefixes of other defined mappings otherwise
476+
some of your entities cannot be found by Doctrine. This option defaults
477+
to the bundle namespace + ``Entity``, for example for an application bundle
478+
called AcmeHelloBundle prefix would be ``Acme\HelloBundle\Entity``.
479+
480+
alias
481+
.....
482+
483+
Doctrine offers a way to alias entity namespaces to simpler, shorter names
484+
to be used in DQL queries or for Repository access. When using a bundle
485+
the alias defaults to the bundle name.
486+
487+
is_bundle
488+
.........
489+
490+
This option is a derived value from ``dir`` and by default is set to ``true``
491+
if dir is relative proved by a ``file_exists()`` check that returns ``false``.
492+
It is ``false`` if the existence check returns ``true``. In this case an
493+
absolute path was specified and the metadata files are most likely in a
494+
directory outside of a bundle.
495+
496+
.. index::
497+
single: Configuration; Doctrine DBAL
498+
single: Doctrine; DBAL configuration
499+
500+
.. _`reference-dbal-configuration`:
527501

528502
Custom Mapping Entities in a Bundle
529-
-----------------------------------
503+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
530504

531505
Doctrine's ``auto_mapping`` feature loads annotation configuration from
532506
the ``Entity/`` directory of each bundle *and* looks for other formats (e.g.
@@ -587,7 +561,7 @@ directory instead:
587561
));
588562
589563
Mapping Entities Outside of a Bundle
590-
------------------------------------
564+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
591565

592566
You can also create new mappings, for example outside of the Symfony folder.
593567

@@ -652,7 +626,7 @@ namespace in the ``src/Entity`` directory and gives them an ``App`` alias
652626
));
653627
654628
Detecting a Mapping Configuration Format
655-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
629+
........................................
656630

657631
If the ``type`` on the bundle configuration isn't set, the DoctrineBundle
658632
will try to detect the correct mapping configuration format for the bundle.
@@ -671,7 +645,7 @@ root directory. If the folder exist, Doctrine will fall back to using an
671645
annotation driver.
672646

673647
Default Value of Dir
674-
~~~~~~~~~~~~~~~~~~~~
648+
....................
675649

676650
If ``dir`` is not specified, then its default value depends on which configuration
677651
driver is being used. For drivers that rely on the PHP files (annotation,

0 commit comments

Comments
 (0)