{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1392","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1392/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1392/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1392/events","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1392","id":140632434,"number":1392,"title":"How can I disable lazy loading?","user":{"login":"Alex-D","id":426843,"avatar_url":"https://avatars.githubusercontent.com/u/426843?v=3","gravatar_id":"","url":"https://api.github.com/users/Alex-D","html_url":"https://github.com/Alex-D","followers_url":"https://api.github.com/users/Alex-D/followers","following_url":"https://api.github.com/users/Alex-D/following{/other_user}","gists_url":"https://api.github.com/users/Alex-D/gists{/gist_id}","starred_url":"https://api.github.com/users/Alex-D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alex-D/subscriptions","organizations_url":"https://api.github.com/users/Alex-D/orgs","repos_url":"https://api.github.com/users/Alex-D/repos","events_url":"https://api.github.com/users/Alex-D/events{/privacy}","received_events_url":"https://api.github.com/users/Alex-D/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-14T10:23:52Z","updated_at":"2016-03-14T17:27:24Z","closed_at":null,"body":"I have optimized my requests and the result is OK but FOSRestBundle call JMSSerializer with lazy loading by default.\r\n\r\nThere is any option to change that?\r\n\r\nI have found that: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Resources/config/serializer.xml#L12 but I do know how to change that from my config file.\r\n\r\nI do not want use annotations and groups in my models because I've a lot of views and I prefer write optimized requests manually.\r\n\r\nThanks :)"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/comments/196423288","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1392#issuecomment-196423288","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1392","id":196423288,"user":{"login":"Alex-D","id":426843,"avatar_url":"https://avatars.githubusercontent.com/u/426843?v=3","gravatar_id":"","url":"https://api.github.com/users/Alex-D","html_url":"https://github.com/Alex-D","followers_url":"https://api.github.com/users/Alex-D/followers","following_url":"https://api.github.com/users/Alex-D/following{/other_user}","gists_url":"https://api.github.com/users/Alex-D/gists{/gist_id}","starred_url":"https://api.github.com/users/Alex-D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alex-D/subscriptions","organizations_url":"https://api.github.com/users/Alex-D/orgs","repos_url":"https://api.github.com/users/Alex-D/repos","events_url":"https://api.github.com/users/Alex-D/events{/privacy}","received_events_url":"https://api.github.com/users/Alex-D/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T17:27:24Z","updated_at":"2016-03-14T17:27:24Z","body":"I've search all day long, there is no solution. And it's so sad.\r\n\r\nI've used `getArrayResult()` in my repositories to get an array and do not pass through the Serializer crazy loading.\r\n\r\nYou can close if you think it's not a problem. I think it's a problem: You can't base your response on object without lazy load a lot of things. If I use annotations, lazy load is limited, but it use `n` or `n²` requests that take some milliseconds. So at the end, you can have 100ms of additionnal queries by lazy loading. So you need to make that query AND put a lot of annotations to avoid that: that's a non-sens in my opinion.\r\n\r\nMaybe I do take the good way to do my queries, but annotions don't solve my problem.\r\n\r\nMaybe it's a JMSSerializer specific problem... I don't know."}}