{"action":"created","comment":{"url":"https://api.github.com/repos/portphp/portphp/pulls/comments/31502256","id":31502256,"diff_hunk":"@@ -0,0 +1,254 @@\n+Readers read data that will be imported by iterating over it. This library\n+includes a handful of readers. Additionally, you can easily\n+[implement your own](#create-a-reader).\n+\n+You can use readers on their own, or construct a workflow from them:\n+\n+```php\n+$workflow = new Workflow($reader);\n+```\n+## Arrays\n+\n+Reads arrays. Most useful for testing your workflow.\n+\n+## CSV\n+\n+Install the CVS add-on:\n+\n+```bash\n+$ composer require portphp/csv\n+```\n+\n+Reads CSV files, and is optimized to use as little memory as possible.\n+\n+```php\n+use Port\\Reader\\Csv\\CsvReader;\n+\n+$file = new \\SplFileObject('/path/to/csv_file.csv');\n+$reader = new CsvReader($file);\n+```\n+\n+Optionally construct with different delimiter, enclosure and/or escape\n+character:\n+\n+```php\n+$reader = new CsvReader($file, ';');\n+```\n+\n+Then iterate over the CSV file:\n+\n+```php\n+foreach ($reader as $row) {\n+    // $row will be an array containing the comma-separated elements of the line:\n+    // array(\n+    //   0 => 'James',\n+    //   1 => 'Bond'\n+    //   etc...\n+    // )\n+}\n+```\n+\n+### Column headers\n+\n+If one of your rows contains column headers, you can read them to make the rows\n+associative arrays:\n+\n+```php\n+$reader->setHeaderRowNumber(0);\n+\n+foreach ($reader as $row) {\n+    // $row will now be an associative array:\n+    // array(\n+    //   'firstName' => 'James',\n+    //   'lastName'  => 'Bond'\n+    //   etc...\n+    // )\n+}\n+```\n+\n+### Strict mode\n+\n+The CSV reader operates in strict mode by default. If the reader encounters a\n+row where the number of values differs from the number of column headers, an\n+error is logged and the row is skipped. Retrieve the errors with `getErrors()`.\n+\n+To disable strict mode, set `$reader->setStrict(false)` after you instantiate\n+the reader.\n+\n+Disabling strict mode means:\n+\n+1. Any rows that contain fewer values than the column headers are simply\n+   padded with null values.\n+2. Any additional values in a row that contain more values than the\n+   column headers are ignored.\n+\n+Examples where this is useful:\n+\n+- **Outlook 2010:** which omits trailing blank values\n+- **Google Contacts:** which exports more values than there are column headers\n+\n+### Duplicate headers\n+\n+Sometimes a CSV file contains duplicate column headers, for instance:\n+\n+id  | details  | details\n+--- | -------- | --------\n+1   | bla      | more bla\n+\n+By default, a `DuplicateHeadersException` will be thrown if you call\n+`setHeaderRowNumber(0)` on this file. You can handle duplicate columns in\n+one of three ways:\n+* call `setColumnHeaders(['id', 'details', 'details_2'])` to specify your own\n+  headers\n+* call `setHeaderRowNumber` with the `CsvReader::DUPLICATE_HEADERS_INCREMENT`\n+  flag to generate incremented headers; in this case: `id`, `details` and\n+  `details1`\n+* call `setHeaderRowNumber` with the `CsvReader::DUPLICATE_HEADERS_MERGE` flag\n+  to merge duplicate values into arrays; in this case, the first row’s values\n+  will become: `[ 'id' => 1, 'details' => [ 'bla', 'more bla' ] ]`.\n+\n+## Doctrine DBAL\n+\n+Reads data through [Doctrine’s DBAL](http://www.doctrine-project.org/projects/dbal.html).\n+Your project should include Doctrine’s DBAL package:\n+\n+```bash\n+$ composer require doctrine/dbal\n+```\n+\n+```php\n+use Port\\Reader\\Dbal\\DbalReader;\n+\n+$reader = new DbalReader(\n+    $connection, // Instance of \\Doctrine\\DBAL\\Connection\n+    'SELECT u.id, u.username, g.name FROM `user` u INNER JOIN groups g ON u.group_id = g.id'\n+);\n+```\n+\n+## Doctrine ORM/ODM\n+\n+Reads data through the [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html):\n+\n+```php\n+use Port\\Reader\\Doctrine\\DoctrineReader;","path":"docs/readers.md","position":133,"original_position":133,"commit_id":"df06dab619f08d0df37e7ebf0b46eb2ffe826968","original_commit_id":"946dd791536968d165dbf9b80874406acfa29950","user":{"login":"Baachi","id":833645,"avatar_url":"https://avatars.githubusercontent.com/u/833645?v=3","gravatar_id":"","url":"https://api.github.com/users/Baachi","html_url":"https://github.com/Baachi","followers_url":"https://api.github.com/users/Baachi/followers","following_url":"https://api.github.com/users/Baachi/following{/other_user}","gists_url":"https://api.github.com/users/Baachi/gists{/gist_id}","starred_url":"https://api.github.com/users/Baachi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Baachi/subscriptions","organizations_url":"https://api.github.com/users/Baachi/orgs","repos_url":"https://api.github.com/users/Baachi/repos","events_url":"https://api.github.com/users/Baachi/events{/privacy}","received_events_url":"https://api.github.com/users/Baachi/received_events","type":"User","site_admin":false},"body":"Nope it doesn't accept ODM","created_at":"2015-06-02T08:40:48Z","updated_at":"2015-06-02T08:40:48Z","html_url":"https://github.com/portphp/portphp/pull/12#discussion_r31502256","pull_request_url":"https://api.github.com/repos/portphp/portphp/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/portphp/portphp/pulls/comments/31502256"},"html":{"href":"https://github.com/portphp/portphp/pull/12#discussion_r31502256"},"pull_request":{"href":"https://api.github.com/repos/portphp/portphp/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/portphp/portphp/pulls/12","id":36670772,"html_url":"https://github.com/portphp/portphp/pull/12","diff_url":"https://github.com/portphp/portphp/pull/12.diff","patch_url":"https://github.com/portphp/portphp/pull/12.patch","issue_url":"https://api.github.com/repos/portphp/portphp/issues/12","number":12,"state":"open","locked":false,"title":"[WIP] Rewrite documentation","user":{"login":"ddeboer","id":89267,"avatar_url":"https://avatars.githubusercontent.com/u/89267?v=3","gravatar_id":"","url":"https://api.github.com/users/ddeboer","html_url":"https://github.com/ddeboer","followers_url":"https://api.github.com/users/ddeboer/followers","following_url":"https://api.github.com/users/ddeboer/following{/other_user}","gists_url":"https://api.github.com/users/ddeboer/gists{/gist_id}","starred_url":"https://api.github.com/users/ddeboer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddeboer/subscriptions","organizations_url":"https://api.github.com/users/ddeboer/orgs","repos_url":"https://api.github.com/users/ddeboer/repos","events_url":"https://api.github.com/users/ddeboer/events{/privacy}","received_events_url":"https://api.github.com/users/ddeboer/received_events","type":"User","site_admin":false},"body":"View built version at http://portphp.readthedocs.org/en/docs/.\r\n\r\nNote: this is WIP; there’s much that still needs to be done.","created_at":"2015-06-01T21:05:04Z","updated_at":"2015-06-02T08:40:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55e541b38cca9600fc30451821af5ae46f7ac13c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/portphp/portphp/pulls/12/commits","review_comments_url":"https://api.github.com/repos/portphp/portphp/pulls/12/comments","review_comment_url":"https://api.github.com/repos/portphp/portphp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/portphp/portphp/issues/12/comments","statuses_url":"https://api.github.com/repos/portphp/portphp/statuses/df06dab619f08d0df37e7ebf0b46eb2ffe826968","head":{"label":"portphp:docs","ref":"docs","sha":"df06dab619f08d0df37e7ebf0b46eb2ffe826968","user":{"login":"portphp","id":12632306,"avatar_url":"https://avatars.githubusercontent.com/u/12632306?v=3","gravatar_id":"","url":"https://api.github.com/users/portphp","html_url":"https://github.com/portphp","followers_url":"https://api.github.com/users/portphp/followers","following_url":"https://api.github.com/users/portphp/following{/other_user}","gists_url":"https://api.github.com/users/portphp/gists{/gist_id}","starred_url":"https://api.github.com/users/portphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portphp/subscriptions","organizations_url":"https://api.github.com/users/portphp/orgs","repos_url":"https://api.github.com/users/portphp/repos","events_url":"https://api.github.com/users/portphp/events{/privacy}","received_events_url":"https://api.github.com/users/portphp/received_events","type":"Organization","site_admin":false},"repo":{"id":36492609,"name":"portphp","full_name":"portphp/portphp","owner":{"login":"portphp","id":12632306,"avatar_url":"https://avatars.githubusercontent.com/u/12632306?v=3","gravatar_id":"","url":"https://api.github.com/users/portphp","html_url":"https://github.com/portphp","followers_url":"https://api.github.com/users/portphp/followers","following_url":"https://api.github.com/users/portphp/following{/other_user}","gists_url":"https://api.github.com/users/portphp/gists{/gist_id}","starred_url":"https://api.github.com/users/portphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portphp/subscriptions","organizations_url":"https://api.github.com/users/portphp/orgs","repos_url":"https://api.github.com/users/portphp/repos","events_url":"https://api.github.com/users/portphp/events{/privacy}","received_events_url":"https://api.github.com/users/portphp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/portphp/portphp","description":"Data import/export workflow for PHP","fork":false,"url":"https://api.github.com/repos/portphp/portphp","forks_url":"https://api.github.com/repos/portphp/portphp/forks","keys_url":"https://api.github.com/repos/portphp/portphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/portphp/portphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/portphp/portphp/teams","hooks_url":"https://api.github.com/repos/portphp/portphp/hooks","issue_events_url":"https://api.github.com/repos/portphp/portphp/issues/events{/number}","events_url":"https://api.github.com/repos/portphp/portphp/events","assignees_url":"https://api.github.com/repos/portphp/portphp/assignees{/user}","branches_url":"https://api.github.com/repos/portphp/portphp/branches{/branch}","tags_url":"https://api.github.com/repos/portphp/portphp/tags","blobs_url":"https://api.github.com/repos/portphp/portphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/portphp/portphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/portphp/portphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/portphp/portphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/portphp/portphp/statuses/{sha}","languages_url":"https://api.github.com/repos/portphp/portphp/languages","stargazers_url":"https://api.github.com/repos/portphp/portphp/stargazers","contributors_url":"https://api.github.com/repos/portphp/portphp/contributors","subscribers_url":"https://api.github.com/repos/portphp/portphp/subscribers","subscription_url":"https://api.github.com/repos/portphp/portphp/subscription","commits_url":"https://api.github.com/repos/portphp/portphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/portphp/portphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/portphp/portphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/portphp/portphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/portphp/portphp/contents/{+path}","compare_url":"https://api.github.com/repos/portphp/portphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/portphp/portphp/merges","archive_url":"https://api.github.com/repos/portphp/portphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/portphp/portphp/downloads","issues_url":"https://api.github.com/repos/portphp/portphp/issues{/number}","pulls_url":"https://api.github.com/repos/portphp/portphp/pulls{/number}","milestones_url":"https://api.github.com/repos/portphp/portphp/milestones{/number}","notifications_url":"https://api.github.com/repos/portphp/portphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/portphp/portphp/labels{/name}","releases_url":"https://api.github.com/repos/portphp/portphp/releases{/id}","created_at":"2015-05-29T08:51:42Z","updated_at":"2015-06-01T07:14:02Z","pushed_at":"2015-06-02T08:20:35Z","git_url":"git://github.com/portphp/portphp.git","ssh_url":"git@github.com:portphp/portphp.git","clone_url":"https://github.com/portphp/portphp.git","svn_url":"https://github.com/portphp/portphp","homepage":"https://portphp.readthedocs.org","size":0,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"master"}},"base":{"label":"portphp:master","ref":"master","sha":"17b6872a0f26770199a167723592047a56661d2d","user":{"login":"portphp","id":12632306,"avatar_url":"https://avatars.githubusercontent.com/u/12632306?v=3","gravatar_id":"","url":"https://api.github.com/users/portphp","html_url":"https://github.com/portphp","followers_url":"https://api.github.com/users/portphp/followers","following_url":"https://api.github.com/users/portphp/following{/other_user}","gists_url":"https://api.github.com/users/portphp/gists{/gist_id}","starred_url":"https://api.github.com/users/portphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portphp/subscriptions","organizations_url":"https://api.github.com/users/portphp/orgs","repos_url":"https://api.github.com/users/portphp/repos","events_url":"https://api.github.com/users/portphp/events{/privacy}","received_events_url":"https://api.github.com/users/portphp/received_events","type":"Organization","site_admin":false},"repo":{"id":36492609,"name":"portphp","full_name":"portphp/portphp","owner":{"login":"portphp","id":12632306,"avatar_url":"https://avatars.githubusercontent.com/u/12632306?v=3","gravatar_id":"","url":"https://api.github.com/users/portphp","html_url":"https://github.com/portphp","followers_url":"https://api.github.com/users/portphp/followers","following_url":"https://api.github.com/users/portphp/following{/other_user}","gists_url":"https://api.github.com/users/portphp/gists{/gist_id}","starred_url":"https://api.github.com/users/portphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portphp/subscriptions","organizations_url":"https://api.github.com/users/portphp/orgs","repos_url":"https://api.github.com/users/portphp/repos","events_url":"https://api.github.com/users/portphp/events{/privacy}","received_events_url":"https://api.github.com/users/portphp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/portphp/portphp","description":"Data import/export workflow for PHP","fork":false,"url":"https://api.github.com/repos/portphp/portphp","forks_url":"https://api.github.com/repos/portphp/portphp/forks","keys_url":"https://api.github.com/repos/portphp/portphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/portphp/portphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/portphp/portphp/teams","hooks_url":"https://api.github.com/repos/portphp/portphp/hooks","issue_events_url":"https://api.github.com/repos/portphp/portphp/issues/events{/number}","events_url":"https://api.github.com/repos/portphp/portphp/events","assignees_url":"https://api.github.com/repos/portphp/portphp/assignees{/user}","branches_url":"https://api.github.com/repos/portphp/portphp/branches{/branch}","tags_url":"https://api.github.com/repos/portphp/portphp/tags","blobs_url":"https://api.github.com/repos/portphp/portphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/portphp/portphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/portphp/portphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/portphp/portphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/portphp/portphp/statuses/{sha}","languages_url":"https://api.github.com/repos/portphp/portphp/languages","stargazers_url":"https://api.github.com/repos/portphp/portphp/stargazers","contributors_url":"https://api.github.com/repos/portphp/portphp/contributors","subscribers_url":"https://api.github.com/repos/portphp/portphp/subscribers","subscription_url":"https://api.github.com/repos/portphp/portphp/subscription","commits_url":"https://api.github.com/repos/portphp/portphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/portphp/portphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/portphp/portphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/portphp/portphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/portphp/portphp/contents/{+path}","compare_url":"https://api.github.com/repos/portphp/portphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/portphp/portphp/merges","archive_url":"https://api.github.com/repos/portphp/portphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/portphp/portphp/downloads","issues_url":"https://api.github.com/repos/portphp/portphp/issues{/number}","pulls_url":"https://api.github.com/repos/portphp/portphp/pulls{/number}","milestones_url":"https://api.github.com/repos/portphp/portphp/milestones{/number}","notifications_url":"https://api.github.com/repos/portphp/portphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/portphp/portphp/labels{/name}","releases_url":"https://api.github.com/repos/portphp/portphp/releases{/id}","created_at":"2015-05-29T08:51:42Z","updated_at":"2015-06-01T07:14:02Z","pushed_at":"2015-06-02T08:20:35Z","git_url":"git://github.com/portphp/portphp.git","ssh_url":"git@github.com:portphp/portphp.git","clone_url":"https://github.com/portphp/portphp.git","svn_url":"https://github.com/portphp/portphp","homepage":"https://portphp.readthedocs.org","size":0,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/portphp/portphp/pulls/12"},"html":{"href":"https://github.com/portphp/portphp/pull/12"},"issue":{"href":"https://api.github.com/repos/portphp/portphp/issues/12"},"comments":{"href":"https://api.github.com/repos/portphp/portphp/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/portphp/portphp/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/portphp/portphp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/portphp/portphp/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/portphp/portphp/statuses/df06dab619f08d0df37e7ebf0b46eb2ffe826968"}}}}