Skip to content

Commit

Permalink
Merge pull request #88 from Engerim/patch-1
Browse files Browse the repository at this point in the history
changed installation guide for symfony 2.1
  • Loading branch information
stof committed Apr 3, 2012
2 parents 1cfb6ba + b1935f5 commit 1216358
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 1216358

Please sign in to comment.