When using embeds, straight from the Fractal docs :
class ResortTransformer extends \League\Fractal\TransformerAbstract
{
/**
* Embed if requested
*
* @var array
*/
protected $availableEmbeds = ['amenities'];
/**
* Embed amenities on the resort
*
* @return Collection
*/
public function embedAmenities(Resort $resort)
{
return $this->collection($resort->amenities, new AmenityTransformer);
}
}
Instead of getting this:
{
"name": "something",
"amenities": [
{
"an": "amenity"
},
{
"another": "amenity"
},
]
}
I'm getting this:
{
"name": "something",
"amenities": {
"data": [
{
"an": "amenity"
},
{
"another": "amenity"
},
]
}
}
Is this expected behavior ? And if yes is there a workaround? Or is it a Fractal issue?
When using embeds, straight from the Fractal docs :
Instead of getting this:
{ "name": "something", "amenities": [ { "an": "amenity" }, { "another": "amenity" }, ] }I'm getting this:
{ "name": "something", "amenities": { "data": [ { "an": "amenity" }, { "another": "amenity" }, ] } }Is this expected behavior ? And if yes is there a workaround? Or is it a Fractal issue?