Closed banandam closed 8 years ago
Are you extending Fractals TransformerAbstract
class?
Yes i am not extend. Thx. it's my mistake. and one more question
Cities paginate include the state and country Transformer. out put given below.
But state reference also add "data" attribute. How can skip it ?
{ "data": [ { "id": 1, "name": "karla", "state_id": 1, "country_id": 1, "State": { "data": { "id": 1, "name": "Tamil Nadu", "country_id": 1 } }, "Country": { "data": { "id": 1, "name": "PAKI", "iso2": "IN", "iso3": "IND" } } } ], "meta": { "pagination": { "total": 1, "count": 1, "per_page": 20, "current_page": 1, "total_pages": 1, "links": [] } } }
if you will remove that data attribute then how will you format the response result that includes meta data ? it is required to identify the data array without it how will you merge the array's ?
Country hasmany Cities cities belongsto Country Country hasMany States States belongsto Country
Relation ship set. after i accesses paginate CountryTransformer get on undefined method issue. Errors given below
Call to undefined method app\Transformers\CountryTransformer::getDefaultIncludes() in \lumen\vendor\dingo\api\src\Transformer\Adapter\Fractal.php on line 193
Code: