Skip to content

Commit e3156d4

Browse files
committed
Records::getError() → Records::error
1 parent 33807d4 commit e3156d4

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ the CQL query, and the second optional argument is the number of records to fetc
4545

4646
```php
4747
$records = $client->records('dc.title="Hello world"');
48+
if ($records->error) {
49+
print 'ERROR: ' . $records->error . "\n";
50+
}
4851
foreach ($records as $record) {
4952
echo "Got record " . $record->position . " of " . $records->numberOfRecords() . "\n";
5053
// processRecord($record->data);

src/Records.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public function __construct($cql, Client $client, $count = 10, $httpClient = nul
5353
*
5454
* @return string|null
5555
*/
56-
public function getError()
57-
{
58-
return $this->lastResponse->error;
56+
function __get($prop) {
57+
if ($prop == 'error') {
58+
return $this->lastResponse->error;
59+
}
5960
}
6061

6162
/**

tests/RecordsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function testIterating()
1515

1616
$client = new Client($uri);
1717
$records = new Records($cql, $client, 10, $http);
18-
$this->assertNull($records->getError());
18+
$this->assertNull($records->error);
1919
$this->assertEquals(8, $records->numberOfRecords());
2020
$records->rewind();
21-
$this->assertNull($records->getError());
21+
$this->assertNull($records->error);
2222

2323
$this->assertEquals(1, $records->key());
2424
$this->assertTrue($records->valid());

0 commit comments

Comments
 (0)