Skip to content

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

@victorsferreira

Description

@victorsferreira

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions