yii-tools / data-provider
Proveedores de datos para Yii3.
Installs: 3 812
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- yiisoft/active-record: ^3.0@dev
- yiisoft/arrays: ^3.0
- yiisoft/db: ^1.0
Requires (Dev)
- maglnet/composer-require-checker: ^4.3
- phpunit/phpunit: ^10.0
- roave/infection-static-analysis-plugin: ^1.31
- vimeo/psalm: ^5.8
- yiisoft/cache: ^3.0
- yiisoft/db-sqlite: ^1.0
This package is auto-updated.
Last update: 2024-11-30 02:33:25 UTC
README
Data Provider for YiiFramework v. 3.0.
Requirements
The minimun version of PHP required by this package is PHP 8.1.
For install this package, you need composer.
Install
composer require yii-tools/data-provider
Usage
ActiveIteratorDataProvider
<?php declare(strict_types=1); use Yii\DataProvider\ActiveIteratorDataProvider; use Yiisoft\ActiveRecord\ActiveQuery; use Yiisoft\Db\Connection\ConnectionInterface; /** @var ConnectionInterface $db */ $userQuery = new ActiveQuery(User::class, $db); $activeIteratorDataProvider = new ActiveDataProvider($userQuery);
ArrayIteratorDataProvider
<?php declare(strict_types=1); use Yii\DataProvider\ArrayIteratorDataProvider; $arrayIteratorDataProvider = new ArrayIteratorDataProvider( [ ['id' => 1, 'name' => 'name1'], ['id' => 2, 'name' => 'name2'], ['id' => 3, 'name' => 'name3'], ], );
QueryIteratorDataProvider
<?php declare(strict_types=1); use Yii\DataProvider\QueryIteratorDataProvider; /** @var ConnectionInterface $db */ $queryIteratorDataProvider = new QueryIteratorDataProvider((new Query($db))->select('*')->from('{{%user}}'));
SQLIteratorDataProvider
<?php declare(strict_types=1); use Yii\DataProvider\SQLIteratorDataProvider; use Yiisoft\Db\Connection\ConnectionInterface; /** @var ConnectionInterface $db */ $sqlIteratorDataProvider = new SQLIteratorDataProvider($db, 'SELECT * FROM {{%user}}');
Testing
Check the documentation testing to learn about testing.
CI status
License
The MIT License (MIT). Please see License File for more information.