Skip to content

Instantly share code, notes, and snippets.

@PhazeonPhoenix
Created November 28, 2012 01:00
Show Gist options
  • Save PhazeonPhoenix/4158310 to your computer and use it in GitHub Desktop.
Save PhazeonPhoenix/4158310 to your computer and use it in GitHub Desktop.
Enable MongoDB in symfony2
public function init() {
parent::init();
if ($this->debug) {
// Disable deprecated warnings so Doctrine\MongoDB will work
error_reporting(E_ALL & ~E_DEPRECATED );
}
}
public function registerBundles()
{
$bundles = array(
// ...
new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
);
// ...
}
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
AnnotationDriver::registerAnnotationClasses();
{
"require": {
"doctrine/mongodb-odm-bundle": "3.0.*"
},
"minimum-stability": "dev"
}
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: test_database
document_managers:
default:
auto_mapping: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment