When I call to_json() on a representer from collection without specifying included records I get the full compound document complete with the included records.
"{\"data\":[
{\"relationships\":{
\"feature-image\":{\"data\":{\"id\":\"1\",\"type\":\"images\"}},
\"images\":{\"data\":[{\"id\":\"1\",\"type\":\"images\"}]},
\"documents\":{\"data\":[]},
},
\"id\":\"1\",
\"attributes\":{
\"name\":\"Site Name 1\",
\"reference\":\"760\",
\"address\":{
\"address_line_one\":\"Addr 1\",
\"town_city\":\"Town\",
\"county\":\"County\",
\"postcode\":\"Some Postcode\",
\"country\":\"England\"
}
},\"type\":\"sites\"},
{\"relationships\":{
\"feature-image\":{\"data\":{\"id\":\"2\",\"type\":\"images\"}},
\"images\":{\"data\":[{\"id\":\"2\",\"type\":\"images\"}]},
\"documents\":{\"data\":[]},
},
\"id\":\"2\",\"attributes\":{
\"name\":\"Site Name 2\",
\"reference\":\"114\",
\"address\":{
\"address_line_one\":\"Addr 1\",
\"town_city\":\"Town\",
\"county\":\"County\",
\"postcode\":\"Some Postcode\",
\"country\":\"England\"
}
},\"type\":\"sites\"}
],
\"included\":[
{\"id\":\"1\",\"attributes\":{\"caption\":\"Exterior view of building\",\"file-url\":\"some_url\"},\"type\":\"images\",\"links\":{\"self\":\"http://images/1\"}},
{\"id\":\"2\",\"attributes\":{\"caption\":\"Interior view of building\",\"file-url\":\"some_url\"},\"type\":\"images\",\"links\":{\"self\":\"http://images/2\"}}
]}"
When I pass in an included option, all relationship attributes are rendered, but nothing is included at all.
"{\"data\":[
{\"relationships\":{
\"feature-image\":{\"data\":{\"id\":\"1\",\"type\":\"images\"}},
\"images\":{\"data\":[{\"id\":\"1\",\"type\":\"images\"}]},
\"documents\":{\"data\":[]},
},
\"id\":\"1\",
\"attributes\":{
\"name\":\"Site Name 1\",
\"reference\":\"760\",
\"address\":{
\"address_line_one\":\"Addr 1\",
\"town_city\":\"Town\",
\"county\":\"County\",
\"postcode\":\"Some Postcode\",
\"country\":\"England\"
}
},\"type\":\"sites\"},
{\"relationships\":{
\"feature-image\":{\"data\":{\"id\":\"2\",\"type\":\"images\"}},
\"images\":{\"data\":[{\"id\":\"2\",\"type\":\"images\"}]},
\"documents\":{\"data\":[]},
},
\"id\":\"2\",\"attributes\":{
\"name\":\"Site Name 2\",
\"reference\":\"114\",
\"address\":{
\"address_line_one\":\"Addr 1\",
\"town_city\":\"Town\",
\"county\":\"County\",
\"postcode\":\"Some Postcode\",
\"country\":\"England\"
}
},\"type\":\"sites\"}
]}"
When doing the same thing for a single representer I get the expected behaviour so I assume this issue is restricted to collections
When I call
to_json()on a representer from collection without specifying included records I get the full compound document complete with the included records.When I pass in an included option, all relationship attributes are rendered, but nothing is included at all.
When doing the same thing for a single representer I get the expected behaviour so I assume this issue is restricted to collections