php-kitchen/yii2-domain

View on GitHub
specs/Unit/Stubs/Base/RecordQuery.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace PHPKitchen\Domain\Specs\Unit\Stubs\Base;

/**
 * Represents
 *
 * @package tests\stubs
 * @author Dmitry Kolodko <prowwid@gmail.com>
 */
class RecordQuery extends \PHPKitchen\Domain\DB\RecordQuery {
    public $records = [];
    public $singleRecord = [];

    public function all($db = null) {
        return $this->records;
    }

    public function one($db = null) {
        return $this->singleRecord;
    }

    public function batch($batchSize = 100, $db = null) {
        return array_chunk($this->records, $batchSize);
    }

    public function each($batchSize = 100, $db = null) {
        return $this->records;
    }

    // @todo implement
    /*public function scalar($db = null) {
        return parent::scalar($db);
    }*/

    public function count($q = '*', $db = null) {
        return count($this->records);
    }
}