{"action":"created","issue":{"url":"https://api.github.com/repos/nextras/orm/issues/184","repository_url":"https://api.github.com/repos/nextras/orm","labels_url":"https://api.github.com/repos/nextras/orm/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/nextras/orm/issues/184/comments","events_url":"https://api.github.com/repos/nextras/orm/issues/184/events","html_url":"https://github.com/nextras/orm/issues/184","id":180530608,"number":184,"title":"Adding entity into relationship loads all entities during the second persist.","user":{"login":"hrach","id":284263,"avatar_url":"https://avatars.githubusercontent.com/u/284263?v=3","gravatar_id":"","url":"https://api.github.com/users/hrach","html_url":"https://github.com/hrach","followers_url":"https://api.github.com/users/hrach/followers","following_url":"https://api.github.com/users/hrach/following{/other_user}","gists_url":"https://api.github.com/users/hrach/gists{/gist_id}","starred_url":"https://api.github.com/users/hrach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrach/subscriptions","organizations_url":"https://api.github.com/users/hrach/orgs","repos_url":"https://api.github.com/users/hrach/repos","events_url":"https://api.github.com/users/hrach/events{/privacy}","received_events_url":"https://api.github.com/users/hrach/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nextras/orm/labels/1-bug","name":"1-bug","color":"BD2C00"},{"url":"https://api.github.com/repos/nextras/orm/labels/3-priority-high","name":"3-priority-high","color":"eeeeee"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-02T19:44:27Z","updated_at":"2016-10-07T06:11:10Z","closed_at":"2016-10-05T21:44:39Z","body":"Due to e5365fcf4bce7f66fed6bdd836e99a89bcd6c3e9 we load the whole collection during the second relationship. However, such behavior may lead to loading very extensive collection.\r\n\r\nExample:\r\n\r\n```php\r\n/**\r\n  * @property Street[] $streets {1:m Street::$country}\r\n  */\r\nclass Country ... {}\r\n\r\n/**\r\n * @property Country $country {m:1 Country::$streets}\r\n */\r\nclass Street ... {}\r\n\r\n\r\n$country->streets->add(new Street());\r\n\r\n// will same new Street & set wasLoaded to true\r\n// https://github.com/nextras/orm/blob/v2.1.1/src/Relationships/OneHasMany.php#L40\r\n$model->persist($country); \r\n\r\n// the repeated call will load entire collections of streets\r\n$model->persist($country);\r\n```"},"comment":{"url":"https://api.github.com/repos/nextras/orm/issues/comments/252161167","html_url":"https://github.com/nextras/orm/issues/184#issuecomment-252161167","issue_url":"https://api.github.com/repos/nextras/orm/issues/184","id":252161167,"user":{"login":"f3l1x","id":538058,"avatar_url":"https://avatars.githubusercontent.com/u/538058?v=3","gravatar_id":"","url":"https://api.github.com/users/f3l1x","html_url":"https://github.com/f3l1x","followers_url":"https://api.github.com/users/f3l1x/followers","following_url":"https://api.github.com/users/f3l1x/following{/other_user}","gists_url":"https://api.github.com/users/f3l1x/gists{/gist_id}","starred_url":"https://api.github.com/users/f3l1x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f3l1x/subscriptions","organizations_url":"https://api.github.com/users/f3l1x/orgs","repos_url":"https://api.github.com/users/f3l1x/repos","events_url":"https://api.github.com/users/f3l1x/events{/privacy}","received_events_url":"https://api.github.com/users/f3l1x/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T06:11:10Z","updated_at":"2016-10-07T06:11:10Z","body":":+1: "}}
{"actor":{"display_login":"f3l1x"}}