Skip to content

Commit 21733af

Browse files
toby-griffithsxabbuh
authored andcommitted
Added note on ODM id notation being different
As the ODM YML notation for the `id` field is different, I've added a note, as I spent ages wondering why it wasn't working for me.
1 parent 09b2a35 commit 21733af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doctrine.rst

+5
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ directly inside the ``Product`` class via DocBlock annotations:
337337
not possible to mix YAML metadata definitions with annotated PHP entity
338338
class definitions.
339339

340+
.. note::
341+
342+
If using the Doctrine ODM the mapping of the `id` field is slightly different. You should define the field as normal, under the `fields` key, and add `id: true` to the definition. See the `Doctrine MongoDB YAML Driver documentation <http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/yml-mapping.html>`_ for more info.
343+
Using the above format will result in the error "No identifier/primary key specified for Document '<document class>'. Every Document must have an identifier/primary key.".
344+
340345
.. tip::
341346

342347
The table name is optional and if omitted, will be determined automatically

0 commit comments

Comments
 (0)