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
8 changes: 4 additions & 4 deletions Resources/doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Sample Configuration

.. code-block:: yaml

# app/config/config.yml
# config/packages/doctrine_mongodb.yaml
doctrine_mongodb:
connections:
default:
Expand Down Expand Up @@ -133,7 +133,7 @@ can control. The following configuration options exist for a mapping:
this path is relative it is assumed to be relative to the bundle root. This
only works if the name of your mapping is a bundle name. If you want to use
this option to specify absolute paths you should prefix the path with the
kernel parameters that exist in the DIC (for example %kernel.root_dir%).
kernel parameters that exist in the DIC (for example %kernel.project_dir%).
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved

- ``prefix`` A common namespace prefix that all documents of this mapping
share. This prefix should never conflict with prefixes of other defined
Expand Down Expand Up @@ -184,7 +184,7 @@ The following configuration shows a bunch of mapping examples:
alias: BundleAlias
doctrine_extensions:
type: xml
dir: "%kernel.root_dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
dir: "%kernel.project_dir%/src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
prefix: DoctrineExtensions\Documents\
alias: DExt

Expand All @@ -207,7 +207,7 @@ The following configuration shows a bunch of mapping examples:
<doctrine_mongodb:mapping name="MyBundle5" type="xml" dir="my-bundle-mappings-dir" alias="BundleAlias" />
<doctrine_mongodb:mapping name="doctrine_extensions"
type="xml"
dir="%kernel.root_dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
dir="%kernel.project_dir%/src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
prefix="DoctrineExtensions\Documents\"
alias="DExt" />
</doctrine_mongodb:document-manager>
Expand Down
2 changes: 2 additions & 0 deletions Resources/doc/first_steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ repositories as services you can use the following service configuration:

.. code-block:: yaml

# config/services.yaml
services:
_defaults:
autowire: true
Expand All @@ -474,6 +475,7 @@ repositories as services you can use the following service configuration:

.. code-block:: xml

<!-- config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
38 changes: 18 additions & 20 deletions Resources/doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,36 @@ To install DoctrineMongoDBBundle with Composer run the following command:

composer require doctrine/mongodb-odm-bundle

All that is left to do is to update your ``AppKernel.php`` file, and
register the new bundle:

Enable the Bundle
malarzm marked this conversation as resolved.
Show resolved Hide resolved
-----------------

Your bundle should be automatically enabled if you use Flex.
Otherwise, you'll need to manually enable the bundle by adding the
following line in the ``config/bundles.php`` file of your project:

.. code-block:: php

// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
];
// config/bundles.php
<?php

return [
// ...
}
Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle::class => ['all' => true],
];

Configuration
-------------

To get started, you'll need some basic configuration that sets up the document
manager. The easiest way is to enable ``auto_mapping``, which will activate
Flex recipe will automatically create ``config/packages/doctrine_mongodb.yaml``
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved
file with default configuration. Without Flex you need to create the file
manually and fill it with some basic configuration that sets up the document manager.
The recommended way is to enable ``auto_mapping``, which will activate
the MongoDB ODM across your application:

.. code-block:: yaml

# app/config/parameters.yml
parameters:
mongodb_server: "mongodb://localhost:27017"
SzymonKaminski marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: yaml

# app/config/config.yml
# config/packages/doctrine_mongodb.yaml
doctrine_mongodb:
connections:
default:
Expand All @@ -85,7 +83,7 @@ Authentication
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
# config/services.yaml
parameters:
mongodb_server: "mongodb://username:password@localhost:27017/?authSource=auth-db"

Expand Down
3 changes: 2 additions & 1 deletion Resources/doc/security_bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ the ``entity`` user provider described in `the cookbook`_:

.. code-block:: yaml

# config/packages/security.yaml
security:
providers:
my_mongo_provider:
mongodb: {class: App\Document\User, property: username}

.. code-block:: xml

<!-- app/config/security.xml -->
<!-- config/packages/security.xml -->
<config>
<provider name="my_mongo_provider">
<mongodb class="App\Document\User" property="username" />
Expand Down