Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A paged query class for Yii2 to deal with PHP7 changes in mysqlnd

NotificationsYou must be signed in to change notification settings

Sammaye/yii2-pq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A paged query class for Yii2 to deal with PHP7 changes in mysqlnd

It will load your result set the same way as pagination works usingOFFSET andLIMIT.

This extension is 99% for MySQL users.

Installation

Just include it in your composer:

php composer require "sammaye/yii2-pq":"~1.0.0"

Usage

$query = (new \sammaye\pq\Query)->from(Title::tableName())->where('live=1')->limit(300)->orderBy(['id' => SORT_DESC]);foreach($query->each() as $k => $v){

And it will return in batches of 100 up to 300.

As you can see there is not much to learn about this extension except how to include it.

Note: There is no active record part to this query currently due to thenature of PHP class inheritance and inclusion which means I would have to copy theActiveQuery entirely.

Why?

I noticed that many of my cronjobs failed after an upgrade to PHP7. It was notlong before I realised that there were two changes since PHP5.4:

Added to that, my own observations that unbuffered queries suck meant that I created this.

About

A paged query class for Yii2 to deal with PHP7 changes in mysqlnd

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp