Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting up MongoDb for Symfony2 using composer
    text
    copied!<p>I'm very new to Symfony2, I have followed the guide on the Symfony2 website to install the MongoDb Doctrine bundles using composer (which is also how I installed Symfony2)</p> <p><a href="http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/index.html" rel="nofollow">http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/index.html</a></p> <p>I added the lines into app/autoload.php:</p> <pre><code>use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; AnnotationDriver::registerAnnotationClasses(); </code></pre> <p>and app/AppKernal.php</p> <pre><code>new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(), </code></pre> <p>that were suggested in the guide, but when I try to load the Symfony app (which is just the Demo app) I get the following error:</p> <pre><code>InvalidArgumentException: The service definition "doctrine_mongodb.odm.document_manager" does not exist. </code></pre> <p>[And a lot more trace, let me know if this would be useful]</p> <p>If I comment out the line I added into app/AppKernal.php then the Symfony Demo app loads with no problems.</p> <p>I have run app/check.php and I noticed the following warning:</p> <pre><code>WARNING When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156 Install PHP 5.3.8 or newer if your project uses annotations. </code></pre> <p>I am currently using the PHP version shipped with Ubuntu (5.3.5-1ubuntu7.11) and it looks like the composer/mongodb bits above use Annotations.</p> <p>I can't find anything obvious when I do a Google search and assumed this would be more common if it's really a problem with my PHP version.</p> <p>From what I can tell I will need to either:</p> <ul> <li>Compile PHP from source to upgrade to 5.3.8</li> <li>Install Symfony2 not using composer, as it looks like the old way of installing the MongoDB bundles doesn't use annotations</li> <li>I've totally missed something because I have no idea how Symfony2 works :D</li> </ul> <p>Does anyone have any suggestions or other solutions that would be easier? I'd really like to stick with composer if I can.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload