Skip to content

Added note on ODM id notation being different #7092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
toby-griffiths authored Oct 27, 2016
commit efb52bcd6f27ca681b13c07c2d9c756e69f999fa
5 changes: 5 additions & 0 deletions doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ directly inside the ``Product`` class via DocBlock annotations:
not possible to mix YAML metadata definitions with annotated PHP entity
class definitions.

.. note::

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.
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.".

.. tip::

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