spatie / fractalistic

A framework agnostic, developer friendly wrapper around Fractal
https://freek.dev/644-a-developer-friendly-wrapper-around-fractal
MIT License
382 stars 32 forks source link

Add public function to return resourceName #32

Closed Mahmoudz closed 7 years ago

Mahmoudz commented 7 years ago

There's no way to get the resourceName value, from the Transformer object! It will be useful if you want to use that from the DataArray or Array Serializers as it's used by the JsonApi Serializer.

I'm passing the fractal instance to my parent transformer, which has a function that returns the resource name as follow:

    public function getResourceKey()
    {
        return $this->getFractalInstance()->getResourceName();
    }