2017 © Pedro Peláez
 

library doctrine-migrations-service-provider

Pimple service provider for Doctrine migrations

image

rmasters/doctrine-migrations-service-provider

Pimple service provider for Doctrine migrations

  • Sunday, July 27, 2014
  • by rmasters
  • Repository
  • 1 Watchers
  • 1 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Pimple Doctrine Migrations service provider

Provides the Doctrine DBAL Migrations to Pimple (Silex, Cilex) applications. Based on the Symfony Doctrine Migrations Bundle., (*1)

Uses Dragonfly Development's Pimple ORM service-provider to find differences between your database schema and your entities., (*2)

Also registers a number of console commands using the KnpLabs' Console service-provider., (*3)

Installation

  1. Composer require this package:, (*4)

    composer require "rmasters/doctrine-migrations-service-provider:~1.0"
  2. Register in your application:, (*5)

    $app = new Silex\Application;
    $app = new Pimple\Container;
    
    $app->register(new KnpLabs\Provider\ConsoleServiceProvider, [
        'console.name' => 'Application',
        'console.version' => '1',
        'console.project_directory' => __DIR__ . '/../', // your project root
    ]);
    
    $app->register(new Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider, [
        'orm.proxies.dir' => __DIR__ . '/Proxies',
        'orm.em.options' => [
            'mappings' => [
                [
                    'type' => 'annotation',
                    'namespace' => 'Application\Entity',
                    'path' => __DIR__ . '/../src/Entity',
                    'resources_namespace' => 'Application\Entity',
                    'use_simple_annotation_reader' => false, // Set this to false if you import @ORM for annotations
                ],
            ],
        ],
    ]);
    
    $app->register(new Rossible\DoctrineMigrationsProvider\DoctrineMigrationsServiceProvider, [
        'doctrine.migrations.namespace' => 'Application\Migration',
        'doctrine.migrations.dir_name' => __DIR__ . '/../src/Migration',
    ]);
    

This package requires Pimple 3.x and uses the ServiceProviderInterface and Container interfaces/type-hints that it provides. Silex 2.0 supports this, and Cilex should do soon., (*6)

Configuration

Service Description Default
doctrine.migrations.namespace Namespace migrations are under Application\Migrations
doctrine.migrations.dir_name Directory of migration files app/DoctrineMigrations
doctrine.migrations.table_name Name of table that tracks executed migrations "migration_versions"
doctrine.migrations.name Name of migration suite "Application Migrations"

Commands

The commands mirror those in the Doctrine Migrations bundle for Symfony., (*7)

You will need to setup a PHP script that can execute console commands. See src/Resources/console.php for an example., (*8)

License

Released under the MIT License., (*9)

The Versions