rmasters / doctrine-migrations-service-provider
Pimple service provider for Doctrine migrations
Requires
- dflydev/doctrine-orm-service-provider: ~2.0
- doctrine/migrations: dev-master
- knplabs/console-service-provider: dev-pimple-3 as dev-master
- pimple/pimple: ~3.0
This package is not auto-updated.
Last update: 2024-11-05 03:40:37 UTC
README
Provides the Doctrine DBAL Migrations to Pimple (Silex, Cilex) applications. Based on the Symfony Doctrine Migrations Bundle.
Uses Dragonfly Development's Pimple ORM service-provider to find differences between your database schema and your entities.
Also registers a number of console commands using the KnpLabs' Console service-provider.
Installation
-
Composer require this package:
composer require "rmasters/doctrine-migrations-service-provider:~1.0"
-
Register in your application:
$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.
Configuration
Commands
The commands mirror those in the Doctrine Migrations bundle for Symfony.
You will need to setup a PHP script that can execute console commands. See src/Resources/console.php for an example.
License
Released under the MIT License.