PHP code example of doesntmattr / mongodb-migrations-bundle
1. Go to this page and download the library: Download doesntmattr/mongodb-migrations-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
doesntmattr / mongodb-migrations-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
//...
new AntiMattr\Bundle\MongoDBMigrationsBundle\MongoDBMigrationsBundle(),
];
}
// ...
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Version20130326212938 extends AbstractMigration implements ContainerAwareInterface
{
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
public function up(Database $db)
{
// ... migration content
}
public function postUp(Database $db)
{
$dm = $this->container->get('doctrine.odm.default_document_manager');
// ... update the entities
}
}
bash
# For php 5.6
composer quire "doesntmattr/mongodb-migrations-bundle=^3.0"