@@ -33,6 +33,59 @@ If you wish to use memcache to cache your metadata, you need to configure the
33
33
port : 11211
34
34
instance_class : Memcache
35
35
36
+ Mapping Configuration
37
+ ~~~~~~~~~~~~~~~~~~~~~
38
+
39
+ Explicit definition of all the mapped documents is the only necessary configuration for the ODM and there
40
+ are several configuration options that you can control. The following configuration options exist
41
+ for a mapping:
42
+
43
+ - ``type `` One of "annotations", "xml", "yml", "php" or "static-php". This specifies which type
44
+ of metadata type your mapping uses.
45
+ - ``dir `` Path to the mapping or entity files (depending on the driver). If this path is relative
46
+ it is assumed to be relative to the bundle root. This only works if the name of your mapping
47
+ is a bundle name. If you want to use this option to specifiy absolute paths you should prefix
48
+ the path with the kernel parameters that exist in the DIC (for example %kernel.dir%).
49
+ - ``prefix `` A common namespace prefix that all documents of this mapping share. This prefix
50
+ should never conflict with prefixes of other defined mappings otherwise some of your documents cannot be found
51
+ by Doctrine. This option defaults to the bundle namespace + `Documents `, for example for an
52
+ application bundle called "Hello" prefix would be "Application\H ello\D ocuments".
53
+ - ``alias `` Doctrine offers a way to alias document namespaces to simpler, shorter names to be used
54
+ inqueries or for Repository access.
55
+ - ``is_bundle `` This option is a derived value from ``dir `` and by default is set to true if dir is relative
56
+ proved by a ``file_exists() `` check that returns false. It is false if the existance check returns true.
57
+ In this case an absolute path was specified and the metadata files are most likely in a directory outside of
58
+ a bundle.
59
+
60
+ To avoid having to configure lots of information for your mappings you should follow these conventions:
61
+
62
+ 1. Put all your entities in a directory Documents/ inside your bundle. For example "Application/Hello/Documents/".
63
+ 2. If you are using xml, yml or php mapping put all your configuration files into the
64
+ "Resources/config/doctrine/metadata/doctrine/mongodb/" directory sufficed with dcm.xml, dcm.yml or dcm.php
65
+ respectively.
66
+ 3. Annotations is assumed if an "Documents/" but no "Resources/config/doctrine/metadata/doctrine/mongodb/"
67
+ directory is found.
68
+
69
+ The following configuration shows a bunch of mapping examples:
70
+
71
+ .. code-block :: yaml
72
+
73
+ doctrine.mongodb :
74
+ mappings :
75
+ MyBundle1 : ~
76
+ MyBundle2 : yml
77
+ MyBundle3 : { type: annotation, dir: Documents/ }
78
+ MyBundle4 : { type: xml, dir: Resources/config/doctrine/mapping }
79
+ MyBundle5 :
80
+ type : yml
81
+ dir : my-bundle-mappings-dir
82
+ alias : BundleAlias
83
+ doctrine_extensions :
84
+ type : xml
85
+ dir : %kernel.dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents
86
+ prefix : DoctrineExtensions\Documents\
87
+ alias : DExt
88
+
36
89
Multiple Connections
37
90
~~~~~~~~~~~~~~~~~~~~
38
91
0 commit comments