setono / doctrine-orm-batcher-bundle
Symfony 扩展包,集成了 Doctrine ORM 批处理库
v0.3.4
2023-03-22 08:10 UTC
Requires
- php: >=7.2
- doctrine/doctrine-bundle: ^1.0 || ^2.0
- setono/doctrine-orm-batcher: ^0.6
- symfony/config: ^4.4 || ^5.0 || ^6.0
- symfony/dependency-injection: ^4.4 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.0 || ^6.0
Requires (Dev)
- localheinz/composer-normalize: ^2.13
- matthiasnoback/symfony-dependency-injection-test: ^4.0
- phpstan/phpstan: ^0.11 || ^1.0
- phpstan/phpstan-strict-rules: ^0.11 || ^1.0
- phpunit/phpunit: ^8.0
- roave/security-advisories: dev-master
- symplify/easy-coding-standard: >=6.0
- thecodingmachine/phpstan-safe-rule: ^1.0.1
This package is auto-updated.
Last update: 2024-08-31 00:42:38 UTC
README
将 Doctrine ORM Batcher 库 集成到 Symfony。
安装
步骤 1: 下载扩展包
打开命令行控制台,进入您的项目目录,并执行以下命令以下载此插件的最新稳定版本
$ composer require setono/doctrine-orm-batcher-bundle
此命令需要您全局安装 Composer,请参阅 Composer 文档中的安装章节。
步骤 2: 启用扩展包
通过将其添加到 config/bundles.php
中注册的插件/扩展包列表中,来启用插件
<?php $bundles = [ // ... Setono\DoctrineORMBatcherBundle\SetonoDoctrineORMBatcherBundle::class => ['all' => true], // ... ];
使用
现在您可以将 BatcherFactoryInterface
或 Setono\DoctrineORMBatcher\Query\QueryRebuilderInterface
注入到您的服务中
<?php use Setono\DoctrineORMBatcher\Factory\BatcherFactoryInterface; final class YourService { private $factory; public function __construct(BatcherFactoryInterface $factory) { $this->factory = $factory; } }
使用自动绑定,这将自动工作。如果您不使用自动绑定,您必须在服务定义中注入它
<?xml version="1.0" encoding="UTF-8" ?> <container xmlns="https://symfony.com.cn/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://symfony.com.cn/schema/dic/services https://symfony.com.cn/schema/dic/services/services-1.0.xsd"> <services> <service id="YourService"> <argument type="service" id="Setono\DoctrineORMBatcher\Factory\BatcherFactoryInterface"/> </service> </services> </container>