@@ -426,6 +426,7 @@ not configure anything here, the ODM services will not be loaded.
426426 configuration_id : ~
427427 auto_mapping : true
428428 mappings :
429+ # An array of mapping, which may be a bundle name or an unique name
429430 <name> :
430431 mapping : true
431432 type : ~
@@ -466,6 +467,7 @@ not configure anything here, the ODM services will not be loaded.
466467 <translation alias =" phpcr_locale" />
467468 </namespaces >
468469
470+ <!-- An array of mapping, which may be a bundle name or an unique name -->
469471 <mapping name =" <name>" >
470472 mapping="true"
471473 type="null"
@@ -504,6 +506,7 @@ not configure anything here, the ODM services will not be loaded.
504506 ],
505507 ],
506508 'mappings' => [
509+ // An array of mapping, which may be a bundle name or an unique name
507510 '<name >' => [
508511 'mapping' => true,
509512 'type' => null,
@@ -537,9 +540,10 @@ The service to use as base for building the PHPCR-ODM configuration.
537540
538541**type **: ``boolean ``, **default **: ``true ``
539542
540- When enabled, you can place your mappings in
541- ``<App|Bundle>/Resources/config/doctrine/<Document>.phpcr.xml `` resp. ``*.phpcr.yml ``
542- to configure mappings for documents you provide in the ``<App|Bundle>/Document ``
543+ When enabled, bundles will be automatically loaded and attempted to resolve
544+ mappings by convention in
545+ ``<Bundle>/Resources/config/doctrine/<Document>.phpcr.xml `` resp. ``*.phpcr.yml ``
546+ to configure mappings for documents you provide in the ``<Bundle>/Document ``
543547folder. Otherwise you need to manually configure the mappings section.
544548
545549``auto_generate_proxy_classes ``
@@ -574,9 +578,62 @@ set the alias used by the translation strategy.
574578``mappings ``
575579""""""""""""
576580
577- When ``auto_mapping `` is disabled, you need to explicitly list the bundles
578- handled by this document manager. Usually its fine to just list the bundle
579- names without any actual configuration.
581+ Explicitly define document mappings by configuration. For modern Symfony
582+ applications that do not use a bundle, it is necessary to configure mappings.
583+ For bundles, if ``auto_mapping `` is enabled, you don't usually need to.
584+
585+ .. tip ::
586+
587+ When ``auto_mapping `` is disabled, you need to explicitly list the
588+ bundles handled by this document manager. Usually its fine to just list
589+ the bundle names without any actual configuration.
590+
591+ .. tip ::
592+
593+ DoctrinePhpcrBundle is integrated with symfony/doctrine-bridge (in the same
594+ way that `Doctrine ORM `_ does), relying on the bridge to process mapping
595+ configuration options. Therefore, the mapping options work nearly the same
596+ across two bundles.
597+
598+ There are several configuration options that you can control as part of
599+ a mapping definition:
600+
601+ ``mapping ``
602+ A boolean value and it is usually ``true ``. Set it to ``true `` to
603+ declare it as a mapping and allow the document manager to pick it
604+ up.
605+
606+ ``type ``
607+ One of ``annotation ``, ``xml ``, ``yml ``, ``php `` or ``staticphp ``.
608+ This specifies which type of metadata type your mapping uses.
609+
610+ ``dir ``
611+ Path to the mapping or document files (depending on the driver). If this path
612+ is relative, it is assumed to be relative to the bundle root. This only works
613+ if the name of your mapping is a bundle name. If you want to use this option
614+ to specify absolute paths, you should prefix the path with the kernel
615+ parameters that exist in the DIC (for example ``%kernel.root_dir% ``).
616+
617+ ``prefix ``
618+ A common namespace prefix that all documents of this mapping share. This
619+ prefix should never conflict with prefixes of other defined mappings
620+ otherwise some of your documents cannot be found by Doctrine. This option
621+ defaults to the bundle namespace + ``Document ``, for example for an
622+ application bundle called ``AcmeHelloBundle `` prefix would be
623+ ``Acme\HelloBundle\Document ``.
624+
625+ ``alias ``
626+ Doctrine offers a way to alias document namespaces to simpler, shorter names
627+ to be used in DQL queries or for Repository access. When using a bundle, the
628+ alias defaults to the bundle name.
629+
630+ ``is_bundle ``
631+ This option is a derived value from ``dir `` and by default is set to true if
632+ dir is relative proved by a ``file_exists() `` check that returns false. It
633+ is false if the existence check returns true. In this case, an absolute path
634+ was specified and the metadata files are most likely in a directory outside
635+ of a bundle.
636+
580637
581638``metadata_cache_driver ``
582639"""""""""""""""""""""""""
0 commit comments