nilportugues / laravel5-jsonapi

Laravel 5 JSON API Transformer Package

Home Page:http://nilportugues.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel 5.2 - "Argument 1 passed to MappingFactory::fromArray() must be of the type array, string given"

victorsferreira opened this issue · comments

I'm setting up an example application as documented on Github and I get this error:

FatalThrowableError in MappingFactory.php line 93:
Type error: Argument 1 passed to NilPortugues\Api\Mapping\MappingFactory::fromArray() must be of the type array, string given, called in /var/www/html/..../vendor/nilportugues/laravel5-json-api/src/NilPortugues/Laravel5/JsonApi/Mapper/Mapper.php on line 24

I just the default Employees and Orders resources.

By the way, I had to add these lines to EmployeesTransformer

  public function getRequiredProperties()
   {
       return [];
   }

And namespace App\Http\Controllers\Api; to the namespace of EmployeesController.

Another informations:

The transformers are located in App/Model/Api
The models are located in App/Model/Database
The controllers in App/Http/Controllers/Api

Anything else I should provide (the code, apart from what i posted above is exactly the same as in the documentation) ?

Alright just found the error:

I named OrdersTransformer as OrdersTransformers