Skip to content

Commit

Permalink
Update documentation to use non deprecated feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed May 30, 2024
1 parent d8b13dd commit a5bdf6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/9.0/reader/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ If the header contains duplicates an exception will be thrown on usage.
use League\Csv\Reader;

$csv = Reader::createFromPath('/path/to/file.csv', 'r');
$csv->fetchOne(0); //returns ['field1', 'field2', 'field1', 'field4']
$csv->nth(0); //returns ['field1', 'field2', 'field1', 'field4']
$csv->setHeaderOffset(0); //valid offset but the record contain duplicates
$header_offset = $csv->getHeaderOffset(); //returns 0
$records = $csv->getRecords(); //throws a SyntaxError exception
Expand All @@ -236,7 +236,7 @@ use League\Csv\Reader;
use League\Csv\SyntaxError;

$csv = Reader::createFromPath('/path/to/file.csv', 'r');
$csv->fetchOne(0); //returns ['field1', 'field2', 'field1', 'field4']
$csv->nth(0); //returns ['field1', 'field2', 'field1', 'field4']
$csv->setHeaderOffset(0); //valid offset but the record contain duplicates
$header_offset = $csv->getHeaderOffset(); //returns 0
try {
Expand All @@ -248,11 +248,11 @@ try {

## Document records

To access the CSV records you will need to use the `getRecords` or the `getObjects` methods. The methods
To access the CSV records you will need to use the `getRecords` or the `getRecordsAsObjects` methods. The methods
returns an `Iterator` containing all CSV document records as `array` or as objects. It will extract the
records using the [CSV controls characters](/9.0/connections/controls/).

<p class="message-notice"><code>getRecords</code> and <code>getObjects</code> are part of the <code>TabularDataReader</code> API.</p>
<p class="message-notice"><code>getRecords</code> and <code>getRecordsAsObjects</code> are part of the <code>TabularDataReader</code> API.</p>

```php
use League\Csv\Reader;
Expand Down
2 changes: 1 addition & 1 deletion docs/9.0/reader/tabular-data-reader.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ it is recommended to use the <code>nth</code> method instead.</p>

`firstAsObject` and `nthAsObject` are counterpart of `first` and `nth` respectively but returns `null` or
an instance of the specified object. The methods requires, in addition to the record
offset, the class name and optionnally a header mapper just like `getObjects`.
offset, the class name and optionally a header mapper just like `getRecordsAsObjects`.

```php
use League\Csv\Reader;
Expand Down

0 comments on commit a5bdf6a

Please sign in to comment.