定制 kekos/doctrine-console-factory 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-30