{"action":"created","issue":{"url":"https://api.github.com/repos/sokil/php-mongo/issues/121","labels_url":"https://api.github.com/repos/sokil/php-mongo/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/sokil/php-mongo/issues/121/comments","events_url":"https://api.github.com/repos/sokil/php-mongo/issues/121/events","html_url":"https://github.com/sokil/php-mongo/issues/121","id":125997216,"number":121,"title":"Bug with relations when documents pull disabled","user":{"login":"Guuzen","id":11592018,"avatar_url":"https://avatars.githubusercontent.com/u/11592018?v=3","gravatar_id":"","url":"https://api.github.com/users/Guuzen","html_url":"https://github.com/Guuzen","followers_url":"https://api.github.com/users/Guuzen/followers","following_url":"https://api.github.com/users/Guuzen/following{/other_user}","gists_url":"https://api.github.com/users/Guuzen/gists{/gist_id}","starred_url":"https://api.github.com/users/Guuzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guuzen/subscriptions","organizations_url":"https://api.github.com/users/Guuzen/orgs","repos_url":"https://api.github.com/users/Guuzen/repos","events_url":"https://api.github.com/users/Guuzen/events{/privacy}","received_events_url":"https://api.github.com/users/Guuzen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sokil/php-mongo/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"sokil","id":1829948,"avatar_url":"https://avatars.githubusercontent.com/u/1829948?v=3","gravatar_id":"","url":"https://api.github.com/users/sokil","html_url":"https://github.com/sokil","followers_url":"https://api.github.com/users/sokil/followers","following_url":"https://api.github.com/users/sokil/following{/other_user}","gists_url":"https://api.github.com/users/sokil/gists{/gist_id}","starred_url":"https://api.github.com/users/sokil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokil/subscriptions","organizations_url":"https://api.github.com/users/sokil/orgs","repos_url":"https://api.github.com/users/sokil/repos","events_url":"https://api.github.com/users/sokil/events{/privacy}","received_events_url":"https://api.github.com/users/sokil/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-01-11T17:37:18Z","updated_at":"2016-01-12T08:57:15Z","closed_at":null,"body":"If i try to disable documents pull i get error.\r\nFor example:\r\nforeach ($client->getCollection()->disableDocumentPool()->find()->findAll() as $obj) {\r\n  $relObj = $obj->getRelated(\"rel\"); // returns nonexistent document\r\n}\r\nError:\r\nPHP Notice:  Undefined index: 56530d3c9716130b008b4567 in /var/www/html/vendor/sokil/php-mongo/src/Collection.php on line 501\r\ngetRelated trying to get document from pool when it's disabled.\r\n"},"comment":{"url":"https://api.github.com/repos/sokil/php-mongo/issues/comments/170843064","html_url":"https://github.com/sokil/php-mongo/issues/121#issuecomment-170843064","issue_url":"https://api.github.com/repos/sokil/php-mongo/issues/121","id":170843064,"user":{"login":"urixs","id":12414831,"avatar_url":"https://avatars.githubusercontent.com/u/12414831?v=3","gravatar_id":"","url":"https://api.github.com/users/urixs","html_url":"https://github.com/urixs","followers_url":"https://api.github.com/users/urixs/followers","following_url":"https://api.github.com/users/urixs/following{/other_user}","gists_url":"https://api.github.com/users/urixs/gists{/gist_id}","starred_url":"https://api.github.com/users/urixs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urixs/subscriptions","organizations_url":"https://api.github.com/users/urixs/orgs","repos_url":"https://api.github.com/users/urixs/repos","events_url":"https://api.github.com/users/urixs/events{/privacy}","received_events_url":"https://api.github.com/users/urixs/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T08:57:15Z","updated_at":"2016-01-12T08:57:15Z","body":"For reproducing this bug, DocumentPool should be disabled for both collections.\r\n\r\n```php\r\n(new Obj1())->getCollection()->disableDocumentPool();\r\n$objects2 = (new Obj2)->getCollection()->disableDocumentPool()\r\n    ->find()\r\n    ->limit(2)        // Collection should have minimum 2 documents\r\n    ->findAll();\r\nforeach ($objects2 as $obj2) {\r\n    $obj1 = $obj2->getRelated(\"_Obj1\");     // It's okay\r\n}\r\nforeach ($objects2 as $obj2) {\r\n    $obj1 = $obj2->getRelated(\"_Obj1\");     // It's error\r\n}\r\n```\r\n\r\nError\r\n```\r\nPHP Notice:  Undefined index: 5649e6255b77bf16008b4569 in /var/www/html/vendor/sokil/php-mongo/src/Collection.php on line 501\r\n```"}}