2017 © Pedro Peláez
 

symfony-bundle yadm-bundle

image

makasim/yadm-bundle

  • Monday, June 11, 2018
  • by makasim
  • Repository
  • 3 Watchers
  • 5 Stars
  • 932 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 41 % Grown

The README.md

YadmBundle

Install

Install library, (*1)

$ composer require formapro/yadm-bundle "mikemccabe/json-patch-php:dev-master as 0.1.1"

Register the bundle, (*2)

<?php
# /app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new \Formapro\Yadm\Bundle\YadmBundle(),
        ];

        return $bundles;
    }
}

Configure

yadm:
    mongo_uri: 'mongodb://mongo:27017/db_name'
    migrations: ~ # enable migrations
    models:
      category:
          class: 'Acme\Model\Category'
          collection: 'category'
      product:
          class: 'Acme\Model\Product'
          collection: 'product'
          hydrator: 'app.product.hydrator'

Usage

In your code you can get the storage from registry:, (*3)

<?php

$registry = $container->get('yadm');

$productStorage = $registry->getStorage('Acme\Model\Category');

Migrations

Generate new migration class, (*4)

$ ./bin/console yadm:migrations:generate
  Generated new migration class to "/app/YadmMigrations/Migration20190301122316.php"

Generated migration class example, (*5)

<?php

declare(strict_types=1);

namespace App\YadmMigrations;

use Formapro\Yadm\Migration\Migration;
use Formapro\Yadm\Registry;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Migration20190301122316 implements Migration
{
    public function execute(Registry $yadm): void
    {

    }
}

Execute migrations, (*6)

$ ./bin/console yadm:migrations:migrate
  Next migrations will be executed: 20190301122316, 20190301122500, 20190301122502
  WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)
  Execute migration: 20190301122316
  Execute migration: 20190301122500
  Execute migration: 20190301122502

    ------------------------
    ++ finished in 0s
    ++ 3 migrations executed

Licence

MIT, (*7)

The Versions

11/06 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

11/06 2018

0.4.0

0.4.0.0

  Sources   Download

MIT

The Requires

 

11/06 2018

dev-meta

dev-meta

  Sources   Download

MIT

The Requires

 

07/04 2018

dev-types-converter

dev-types-converter

  Sources   Download

MIT

The Requires

 

02/04 2018
12/03 2018
02/02 2018
02/02 2018
02/02 2018
02/02 2018

dev-fetch-database-from-dsn

dev-fetch-database-from-dsn

  Sources   Download

MIT

The Requires

 

20/03 2017
20/03 2017