{"action":"created","issue":{"url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/21","repository_url":"https://api.github.com/repos/mevdschee/php-crud-api","labels_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/21/comments","events_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/21/events","html_url":"https://github.com/mevdschee/php-crud-api/issues/21","id":132097765,"number":21,"title":"2 steps relations?","user":{"login":"henninghall","id":1652607,"avatar_url":"https://avatars.githubusercontent.com/u/1652607?v=3","gravatar_id":"","url":"https://api.github.com/users/henninghall","html_url":"https://github.com/henninghall","followers_url":"https://api.github.com/users/henninghall/followers","following_url":"https://api.github.com/users/henninghall/following{/other_user}","gists_url":"https://api.github.com/users/henninghall/gists{/gist_id}","starred_url":"https://api.github.com/users/henninghall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henninghall/subscriptions","organizations_url":"https://api.github.com/users/henninghall/orgs","repos_url":"https://api.github.com/users/henninghall/repos","events_url":"https://api.github.com/users/henninghall/events{/privacy}","received_events_url":"https://api.github.com/users/henninghall/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mevdschee/php-crud-api/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"mevdschee","id":1288217,"avatar_url":"https://avatars.githubusercontent.com/u/1288217?v=3","gravatar_id":"","url":"https://api.github.com/users/mevdschee","html_url":"https://github.com/mevdschee","followers_url":"https://api.github.com/users/mevdschee/followers","following_url":"https://api.github.com/users/mevdschee/following{/other_user}","gists_url":"https://api.github.com/users/mevdschee/gists{/gist_id}","starred_url":"https://api.github.com/users/mevdschee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mevdschee/subscriptions","organizations_url":"https://api.github.com/users/mevdschee/orgs","repos_url":"https://api.github.com/users/mevdschee/repos","events_url":"https://api.github.com/users/mevdschee/events{/privacy}","received_events_url":"https://api.github.com/users/mevdschee/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2016-02-08T10:02:34Z","updated_at":"2016-02-09T22:18:21Z","closed_at":null,"body":"I am trying to attach relation data which works great except when it is \"relations relation\". In the example it should be possible to use mysql_crud_api_tranform() to achieve this. \r\n\r\nI want to achieve this: \r\n\r\n`{\r\n    \"posts\": [\r\n        {\r\n            \"id\": \"1\",\r\n            \"post_tags\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"post_id\": \"1\",\r\n                    \"tag_id\": \"1\",\r\n                    \"tags\": [\r\n                        {\r\n                            \"id\": \"1\",\r\n                            \"name\": \"funny\"\r\n                        }\r\n                    ]\r\n                },\r\n                {\r\n                    \"id\": \"2\",\r\n                    \"post_id\": \"1\",\r\n                    \"tag_id\": \"2\",\r\n                    \"tags\": [\r\n                        {\r\n                            \"id\": \"2\",\r\n                            \"name\": \"important\"\r\n                        }\r\n                    ]\r\n                }\r\n            ],\r\n            \"comments\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"post_id\": \"1\",\r\n                    \"message\": \"great\"\r\n                },\r\n                {\r\n                    \"id\": \"2\",\r\n                    \"post_id\": \"1\",\r\n                    \"message\": \"fantastic\"\r\n                }\r\n            ],\r\n            \"user_id\": \"1\",\r\n            \"category_id\": \"1\",\r\n            \"categories\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"name\": \"anouncement\"\r\n                }\r\n            ],\r\n            \"content\": \"blog started\"\r\n        }\r\n    ]\r\n}`\r\n\r\nBut the result is : \r\n\r\n`{\r\n    \"posts\": [\r\n        {\r\n            \"id\": \"1\",\r\n            \"post_tags\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"post_id\": \"1\",\r\n                    \"tag_id\": \"1\",\r\n                },\r\n                {\r\n                    \"id\": \"2\",\r\n                    \"post_id\": \"1\",\r\n                    \"tag_id\": \"2\",\r\n                    \"tags\": [\r\n                        {\r\n                            \"id\": \"2\",\r\n                            \"name\": \"important\"\r\n                        }\r\n                    ]\r\n                }\r\n            ],\r\n            \"comments\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"post_id\": \"1\",\r\n                    \"message\": \"great\"\r\n                },\r\n                {\r\n                    \"id\": \"2\",\r\n                    \"post_id\": \"1\",\r\n                    \"message\": \"fantastic\"\r\n                }\r\n            ],\r\n            \"user_id\": \"1\",\r\n            \"category_id\": \"1\",\r\n            \"categories\": [\r\n                {\r\n                    \"id\": \"1\",\r\n                    \"name\": \"anouncement\"\r\n                }\r\n            ],\r\n            \"content\": \"blog started\"\r\n        }\r\n    ]\r\n    \"tags\": [\r\n                        {\r\n                            \"id\": \"1\",\r\n                            \"name\": \"funny\"\r\n                        }\r\n                    ]\r\n}`\r\n\r\n\r\nDo you know why or how i can fix this? If anyone is achieving the expected result, please provide an example of how you use mysql_crud_api_tranform(). Thanks for a great api! "},"comment":{"url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/comments/182104100","html_url":"https://github.com/mevdschee/php-crud-api/issues/21#issuecomment-182104100","issue_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/21","id":182104100,"user":{"login":"henninghall","id":1652607,"avatar_url":"https://avatars.githubusercontent.com/u/1652607?v=3","gravatar_id":"","url":"https://api.github.com/users/henninghall","html_url":"https://github.com/henninghall","followers_url":"https://api.github.com/users/henninghall/followers","following_url":"https://api.github.com/users/henninghall/following{/other_user}","gists_url":"https://api.github.com/users/henninghall/gists{/gist_id}","starred_url":"https://api.github.com/users/henninghall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henninghall/subscriptions","organizations_url":"https://api.github.com/users/henninghall/orgs","repos_url":"https://api.github.com/users/henninghall/repos","events_url":"https://api.github.com/users/henninghall/events{/privacy}","received_events_url":"https://api.github.com/users/henninghall/received_events","type":"User","site_admin":false},"created_at":"2016-02-09T22:18:21Z","updated_at":"2016-02-09T22:18:21Z","body":"@mevdschee It works brilliantly! Thanks a lot for keeping this api so great! "}}