javer / influxdb-data-fixtures-bundle
提供InfluxDB ODM与Nelmio alice扩展的集成,以持久化加载的测试数据
v1.2.0
2024-01-09 12:10 UTC
Requires
- php: >=8.1
- doctrine/data-fixtures: ^1.3
- javer/influxdb-data-fixtures: ^1.0
- javer/influxdb-odm: ^1.0
- symfony/config: ^5.4 || ^6.0 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0
- symfony/http-foundation: ^5.4 || ^6.0 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.0 || ^7.0
- symfony/yaml: ^5.4 || ^6.0 || ^7.0
- theofidry/alice-data-fixtures: ^1.0
Requires (Dev)
- phpstan/phpstan: ^1.0
- squizlabs/php_codesniffer: 3.8.*
- swivl/php-coding-standard: ^1.4
This package is auto-updated.
Last update: 2024-09-09 19:08:03 UTC
README
此包将InfluxDB Data Fixtures库集成到Symfony中,以便您可以使用Alice将测试数据加载到InfluxDB中。
安装
确保已全局安装Composer,如Composer文档中的安装章节所述。
使用Symfony Flex的应用程序
打开命令行,进入项目目录,执行以下命令
$ composer require javer/influxdb-data-fixtures-bundle
未使用Symfony Flex的应用程序
步骤 1:下载Bundle
打开命令行,进入项目目录,并执行以下命令以下载此Bundle的最新稳定版本
$ composer require javer/influxdb-data-fixtures-bundle
步骤 2:启用Bundle
然后,通过将其添加到项目config/bundles.php文件中注册的Bundle列表中来启用该Bundle
// config/bundles.php return [ // ... Javer\InfluxDB\DataFixturesBundle\JaverInfluxDBDataFixturesBundle::class => ['dev' => true, 'test' => true], ];
使用方法
有关创建Doctrine ODM数据测试数据的文档,请参阅AliceDataFixtures。
创建后,可以使用LoaderInterface
加载测试数据。
<?php $files = [ 'path/to/tests/DataFixtures/InfluxDB/measurement1.yaml', 'path/to/tests/DataFixtures/InfluxDB/measurement2.yaml', ]; $loader = $container->get('javer_influxdb_data_fixtures.loader.influxdb'); // Purge the objects, create PHP objects from the fixture files and persist them $objects = $loader->load($files); // $objects is now an array of persisted `Measurement1` and `Measurement2`