Skip to content
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

Modernize documentation #618

Merged
merged 16 commits into from
Mar 21, 2020
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions Resources/doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ follow these conventions:
into the ``Resources/config/doctrine/`` directory
suffixed with mongodb.xml, mongodb.yml or mongodb.php respectively.

3. Annotations is assumed if a ``Document/`` but no
3. Annotations are assumed if a ``Document/`` but no
``Resources/config/doctrine/`` directory is found.

The following configuration shows a bunch of mapping examples:
Expand Down Expand Up @@ -398,8 +398,8 @@ Using Authentication on a Database Level

MongoDB supports authentication and authorisation on a database-level. This is mandatory if you have
e.g. a publicly accessible MongoDB Server. To make use of this feature you need to configure credentials
for each of your connections. Also every connection needs a database set to authenticate against. The setting is
represented by the *authSource* `connection string <https://docs.mongodb.com/manual/reference/connection-string/#urioption.authSource>`_.
for each of your connections. Every connection needs also a database to authenticate against. The setting is
represented by the *authSource* `connection string`_.
Otherwise you will get a *auth failed* exception.

.. configuration-block::
Expand Down Expand Up @@ -442,7 +442,8 @@ Specifying a context service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The MongoDB driver supports receiving a stream context to set SSL and logging
options. This can be used to authenticate using SSL certificates. To do so, create a service that creates your logging context:
options. This can be used to authenticate using SSL certificates. To do so,
create a service that creates your logging context:

.. configuration-block::

Expand Down
6 changes: 3 additions & 3 deletions Resources/doc/console.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Console Commands
================

The Doctrine2 ODM integration offers several console commands under the
The Doctrine2 ODM integration offers various console commands under the
``doctrine:mongodb`` namespace. To view the command list you can run the console
without any arguments:

.. code-block:: bash

php bin/console

A list of available command will print out, many of which start with the
``doctrine:mongodb`` prefix. You can find out more information about any
A list of available commands will be printed out, several of them start
with the ``doctrine:mongodb`` prefix. You can find out more information about any
of these commands (or any Symfony command) by running the ``help`` command.
For example, to get details about the ``doctrine:mongodb:query`` task, run:

Expand Down
27 changes: 13 additions & 14 deletions Resources/doc/cookbook/registration_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Creating a Registration Form
============================

Some forms have extra fields whose values don't need to be stored in the
database. In this example, we'll create a registration form with some extra
fields and (like a "terms accepted" checkbox field) and embed the form that
actually stores the account information. We'll use MongoDB for storing the data.
database. In this example, we'll create a registration form with such
field ("terms accepted" checkbox field) and embed the form that actually
stores the account information. We'll use MongoDB for storing the data.

The User Model
---------------------

So, in this tutorial we begin with the model for a ``User`` document:
We begin this tutorial with the model for a ``User`` document:

.. code-block:: php

Expand Down Expand Up @@ -72,8 +72,8 @@ So, in this tutorial we begin with the model for a ``User`` document:
}

This ``User`` document contains three fields and two of them (email and
password) should display on the form. The email property must be unique
on the database, so we've added this validation at the top of the class.
password) should be displayed in the form. The email property must be unique
in the database, so we've added this validation at the top of the class.

.. note::

Expand Down Expand Up @@ -135,8 +135,7 @@ form will contain further fields like "accept the terms", whose value won't be
stored in the database.

In other words, create a second form for registration, which embeds the ``User``
form and adds the extra field needed. Start by creating a simple class which
represents the "registration":
form and adds the extra field needed:

.. code-block:: php

Expand Down Expand Up @@ -200,8 +199,8 @@ Next, create the form for this ``Registration`` model:
}
}

You don't need to use special method for embedding the ``UserType`` form.
A form is a field, too - so you can add this like any other field, with the
You don't need to use any special method to embed the ``UserType`` form.
A form is a field, too - you can add it like any other field, with the
expectation that the corresponding ``user`` property will hold an instance
of the class ``UserType``.

Expand Down Expand Up @@ -244,8 +243,8 @@ and its template:
<input type="submit" />
{{ form_end(form) }}

Finally, create the controller which handles the form submission. This performs
the validation and saves the data into MongoDB:
Finally, create another action in ``AccountController``, which will handle
the form submission - perform its validation and save the User into MongoDB:

.. code-block:: php

Expand All @@ -269,8 +268,8 @@ the validation and saves the data into MongoDB:
]);
}

That's it! Your form now validates, and allows you to save the ``User``
object to MongoDB.
That's it! Your form now validates sent data and allows you to save
the ``User`` object to MongoDB.

.. _`UserInterface`: http://symfony.com/doc/current/book/security.html#book-security-user-entity
.. _`file`: http://symfony.com/doc/current/book/forms.html
14 changes: 7 additions & 7 deletions Resources/doc/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ event managers for all connections. To restrict a listener to a single
connection, specify its name in the tag's ``connection`` attribute.

The ``priority`` attribute, which defaults to ``0`` if omitted, may be used
to control the order that listeners are registered. Much like Symfony's
`event dispatcher`_, greater numbers will result in the listener executing
to control the order in which listeners are registered. Much like Symfony's
`event dispatcher`_, greater number will result in the listener executing
first and listeners with the same priority will be executed in the order that
they were registered with the event manager.

Expand Down Expand Up @@ -64,11 +64,11 @@ Event Subscribers
-----------------

Use the ``doctrine_mongodb.odm.event_subscriber`` tag
to register a subscriber. Subscribers are responsible for implementing
``Doctrine\Common\EventSubscriber`` and a method for returning the events
they will observe. For this reason, this tag has no ``event`` attribute;
however, the ``connection``, ``priority`` and ``lazy`` attributes are
available.
to register a subscriber. Subscribers must implement interface
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved
``Doctrine\Common\EventSubscriber``, which means that they must
contain method returning the events they will observe. For this reason,
this tag has no ``event`` attribute, however the ``connection``,
``priority`` and ``lazy`` attributes are available.

.. note::

Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/first_steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ they already exist in MongoDB.
.. tip::

Doctrine provides a library that allows you to programmatically load testing
data into your project (i.e. "fixture data"). For information, see
data into your project (i.e. "fixture data"). For more information, see
`DoctrineFixturesBundle`_.

Fetching Objects from MongoDB
Expand Down
6 changes: 3 additions & 3 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ persisted transparently to and from MongoDB.

You can read more about the Doctrine MongoDB ODM via the project's `documentation`_.

A bundle is available that integrates the Doctrine MongoDB ODM into Symfony,
making it easy to configure and use.
The bundle integrates the Doctrine MongoDB ODM into Symfony,
helping you to configure and use it in your application.

.. note::

This documentation will feel a lot like the `Doctrine2 ORM chapter`_,
which talks about how the Doctrine ORM can be used to persist data to
relational databases (e.g. MySQL). This is on purpose - whether you persist
to a relational database via the ORM or MongoDB via the ODM, the philosophies
to a relational database via the ORM or to MongoDB via the ODM, the philosophies
are very much the same.

.. toctree::
Expand Down
10 changes: 5 additions & 5 deletions Resources/doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ in the `installation chapter`_ of the Composer documentation.
Install the bundle with Symfony Flex
------------------------------------

A Flex recipe for the DoctrineMongoDBBundle is provided through a Contrib Recipe
therefore you need to allow its usage:
A Flex recipe for the DoctrineMongoDBBundle is provided as Contrib Recipe.
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved
You need to allow its usage first:

.. code-block:: bash

Expand Down Expand Up @@ -82,16 +82,16 @@ the MongoDB ODM across your application:
Authentication
--------------

If you use authentication on your MongoDB database you can the provide username,
password, and authentication database in the following way:
If you use authentication on your MongoDB database you can then provide username,
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved
password and authentication database in the following way:
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved

# app/config/parameters.yaml
parameters:
mongodb_server: "mongodb://username:password@localhost:27017/?authSource=auth-db"

.. note::

The authentication database is different to the default database used by MongoDB.
The authentication database is different from the default database used by MongoDB.

.. _`installation chapter`: https://getcomposer.org/doc/00-intro.md
.. _`MongoDB driver`: https://docs.mongodb.com/ecosystem/drivers/php/
Expand Down