Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #88 from Engerim/patch-1

changed installation guide for symfony 2.1
  • Loading branch information...
commit 1216358f8210f326ea51a31baa26951e557b6fe3 2 parents 1cfb6ba + b1935f5
@stof stof authored
Showing with 21 additions and 30 deletions.
  1. +21 −30 Resources/doc/index.rst
View
51 Resources/doc/index.rst
@@ -31,52 +31,43 @@ Installation
------------
To use the MongoDB ODM, you'll need two libraries provided by Doctrine and
-one bundle that integrates them into Symfony. If you're using the Symfony
-Standard Distribution, add the following to the ``deps`` file at the root
-of your project:
+one bundle that integrates them into Symfony.
-.. code-block:: text
+Install the bundle with Composer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- [doctrine-mongodb]
- git=http://github.com/doctrine/mongodb.git
+To install DoctrineMongoDBBundle with Composer just add the following to your
+`composer.json` file::
- [doctrine-mongodb-odm]
- git=http://github.com/doctrine/mongodb-odm.git
-
- [DoctrineMongoDBBundle]
- git=http://github.com/doctrine/DoctrineMongoDBBundle.git
- target=/bundles/Doctrine/Bundle/MongoDBBundle
+ {
+ require: {
+ "doctrine/mongodb-odm-bundle": "dev-master"
+ }
+ }
-Now, update the vendor libraries by running:
+Then, you can install the new dependencies by running Composer's ``update``
+command from the directory where your ``composer.json`` file is located:
-.. code-block:: bash
+.. code-block :: bash
- $ php bin/vendors install
+ php composer.phar update
-Next, add the ``Doctrine\ODM\MongoDB`` and ``Doctrine\MongoDB`` namespaces
-to the ``app/autoload.php`` file so that these libraries can be autoloaded.
-Be sure to add them anywhere *above* the ``Doctrine`` namespace (shown here)::
+Now, Composer will automatically download all required files, and install them
+for you.
- // app/autoload.php
- $loader->registerNamespaces(array(
- // ...
- 'Doctrine\\Bundle' => __DIR__.'/../vendor/bundles',
- 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
- 'Doctrine\\ODM\\MongoDB' => __DIR__.'/../vendor/doctrine-mongodb-odm/lib',
- 'Doctrine\\MongoDB' => __DIR__.'/../vendor/doctrine-mongodb/lib',
- 'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
- // ...
- ));
+Register the annotations and the bundle
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Next, register the annotations library by adding the following to the autoloader
(below the existing ``AnnotationRegistry::registerFile`` line)::
// app/autoload.php
AnnotationRegistry::registerFile(
- __DIR__.'/../vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php'
+ __DIR__.'/../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php'
);
-Finally, enable the new bundle in the kernel::
+All that is left to do is to update your ``AppKernel.php`` file, and
+register the new bundle::
// app/AppKernel.php
public function registerBundles()
Please sign in to comment.
Something went wrong with that request. Please try again.