kekos/doctrine-console-factory
最新稳定版本:v2.0.1
Composer 安装命令:
composer require kekos/doctrine-console-factory
包简介
Helper for adding Doctrine ORM and Migrations console commands to your own Symfony Console application
README 文档
README
Helper for adding Doctrine ORM and Migrations console commands to your own Symfony Console application.
Install
You can install this package via Composer:
composer require kekos/doctrine-console-factory
Documentation
Configuration
If you have the Doctrine Migrations package installed, a ConfigurationLoader
must be given to the DoctrineCommandFactory. This package ships a
MigrationsConfigurationLoader which eliminates the cli-config.php file
in your root directory and can easily be created in your DI container.
<?php // Pseudo container $container->set('doctrine.migrations', [ 'migrations_paths' => [ 'App\\Migrations' => __DIR__ . '/src/Migrations', ], ]); $container->set( Doctrine\Migrations\Configuration\Migration\ConfigurationLoader::class, function($container) { $settings = $container->get('doctrine.migrations'); return new Kekos\DoctrineConsoleFactory\MigrationsConfigurationLoader($settings); } );
Usage
Create an instance of DoctrineCommandFactory and call the addCommands()
and the available Doctrine ORM or Migrations commands will be added to your
Symfony Console application.
<?php $console_app = new Symfony\Component\Console\Application('App', '1.0.0'); // Please let your DI container create the command factory instead! $doctrine_command_factory = new Kekos\DoctrineConsoleFactory\DoctrineCommandFactory( $entity_manager, $configuration_loader ); $doctrine_command_factory->addCommands($console_app); $console_app->run();
Bugs and improvements
Report bugs in GitHub issues or feel free to make a pull request :-)
License
MIT
统计信息
- 总下载量: 4.95k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-30