forked from integry/integry-activerecord
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARInstanceFeed.php
More file actions
33 lines (29 loc) · 739 Bytes
/
ARInstanceFeed.php
File metadata and controls
33 lines (29 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
include_once dirname(__FILE__) . '/ARFeed.php';
/**
* Sequentially read and iterate over records from database
*
* This iterator can be used as data array in foreach and it allows to
* read a very high number of records, as only a small chunk of them is
* being kept in memory at any time.
*
* @author Integry Systems
* @package application.model.
*/
class ARInstanceFeed extends ARFeed
{
protected function loadData()
{
$this->data = ActiveRecord::getRecordSet($this->table, $this->filter, $this->referencedRecords)->getData();
}
protected function getChunkSize()
{
return 20;
}
public function current()
{
$instance = parent::current();
ActiveRecord::removeFromPool($instance);
return $instance;
}
}