sylius-labs/doctrine-migrations-extra-bundle
Composer 安装命令:
composer require sylius-labs/doctrine-migrations-extra-bundle
包简介
README 文档
README
DoctrineMigrationsExtraBundle
Adding a topological sorter and container injection to DoctrineMigrationsBundle.
Installation
- Require this package in your project:
composer require sylius-labs/doctrine-migrations-extra-bundle
- Add this bundle to
config/bundles.php:
return [ // ... SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], ];
- Replace original Doctrine migrations services with the ones from this bundle by adding the following config in
config/packages/doctrine_migrations.yaml:
doctrine_migrations: services: 'Doctrine\Migrations\Version\MigrationFactory': 'SyliusLabs\DoctrineMigrationsExtraBundle\Factory\ContainerAwareVersionFactory' 'Doctrine\Migrations\Version\Comparator': 'SyliusLabs\DoctrineMigrationsExtraBundle\Comparator\TopologicalVersionComparator'
Usage
In an application
In order to define the topology of migrations, configure it in config/packages/sylius_labs_doctrine_migrations_extra.yaml:
sylius_labs_doctrine_migrations_extra: migrations: 'Core\Migrations': ~ 'PluginDependingOnCommonPlugin\Migrations': ['Core\Migrations', 'CommonPlugin\Migrations'] 'CommonPlugin\Migrations': ['Core\Migrations'] 'PluginDependingOnCore\Migrations': ['Core\Migrations']
The following configuration will result in the following order:
Core\MigrationsCommonPlugin\MigrationsPluginDependingOnCommonPlugin\MigrationsPluginDependingOnCore\Migrations
In a bundle
If you want to make your bundle define its dependencies on it own, prepend the configuration in your bundle's extension:
use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; final class AcmeExtension extends Extension implements PrependExtensionInterface { // ... public function prepend(ContainerBuilder $container): void { if (!$container->hasExtension('doctrine_migrations') || !$container->hasExtension('sylius_labs_doctrine_migrations_extra')) { return; } $container->prependExtensionConfig('doctrine_migrations', [ 'migrations_paths' => [ 'Acme\AcmeBundle\Migrations' => '@AcmeBundle/Migrations', ], ]); $container->prependExtensionConfig('sylius_labs_doctrine_migrations_extra', [ 'migrations' => [ 'Acme\AcmeBundle\Migrations' => ['Core\Migrations'], ], ]); } }
Generating new diff
Cause this bundle will dynamically change the configuration of Doctrine Migrations, you may need to specify your own namespace like:
# config/packages/doctrine_migrations.yaml doctrine_migrations: migrations_paths: 'App\Migrations': "%kernel.project_dir%/src/Migrations" # config/packages/sylius_labs_doctrine_migrations_extra.yaml sylius_labs_doctrine_migrations_extra: migrations: 'App\Migrations': ~
After that you will be able to generate again your own migration by calling:
bin/console doctrine:migrations:diff --namespace=App\\Migrations
Versioning and release cycle
This package follows semantic versioning.
Next major releases are not planned yet. Minor and patch releases will be published as needed.
Bug fixes will be provided only for the most recent minor release. Security fixes will be provided for one year since the release of subsequent minor release.
License
This extension is completely free and released under permissive MIT license.
Authors
It is originally created by Kamil Kokot. See the list of all contributors.
sylius-labs/doctrine-migrations-extra-bundle 适用场景与选型建议
sylius-labs/doctrine-migrations-extra-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.15M 次下载、GitHub Stars 达 22, 最近一次更新时间为 2020 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sylius-labs/doctrine-migrations-extra-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sylius-labs/doctrine-migrations-extra-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.15M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 21
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-05