Conditions | 4 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 7.729 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 4 | public function save($writeNow = false) |
|
44 | { |
||
45 | 4 | if( empty($this->data) ) |
|
46 | 4 | { |
|
47 | 4 | $this->onSave(new CEvent($this, array('count' => 0))); |
|
48 | 4 | return 0; |
|
49 | |||
50 | } |
||
51 | |||
52 | if( count($this->data) >= $this->insertChunkSize || $writeNow ) |
||
53 | { |
||
54 | $command = $this->builder->createMultipleInsertCommand($this->table, $this->data); |
||
55 | $count = $command->query()->count(); |
||
56 | |||
57 | $this->data = array(); |
||
58 | $this->onSave(new CEvent($this, array('count' => $count))); |
||
59 | |||
60 | return $count; |
||
61 | } |
||
62 | } |
||
63 | |||
68 | } |