Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
victorsferreira opened this issue Jun 1, 2017 · 1 comment

Comments

@victorsferreira
Copy link

victorsferreira commented Jun 1, 2017

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) ?

@victorsferreira
Copy link
Author

Alright just found the error:

I named OrdersTransformer as OrdersTransformers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant