Skip to content

Proveedores de datos para base de datos de Yii3.

License

Notifications You must be signed in to change notification settings

yii-tools/data-provider

Repository files navigation

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

Build Status codecov Mutation testing badge static analysis type-coverage StyleCI

License

The MIT License (MIT). Please see License File for more information.

Our social networks

Twitter

About

Proveedores de datos para base de datos de Yii3.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages