nilportugues / laravel5-jsonapi

Laravel 5 JSON API Transformer Package
http://nilportugues.com
MIT License
310 stars 70 forks source link

Cannot instantiate abstract class Illuminate\Database\Eloquent\Model #89

Closed novs closed 8 years ago

novs commented 8 years ago

FatalErrorException in MappingFactory.php line 36: Cannot instantiate abstract class Illuminate\Database\Eloquent\Model

  1. in MappingFactory.php line 36
  2. at FatalErrorException->__construct() in HandleExceptions.php line 133
  3. at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
  4. at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
  5. at ReflectionClass->newInstanceWithoutConstructor() in MappingFactory.php line 36
  6. at MappingFactory::getClassProperties() in MappingFactory.php line 206
  7. at MappingFactory::getClassProperties() in MappingFactory.php line 45
  8. at MappingFactory::getClassProperties() in MappingFactory.php line 172
  9. at MappingFactory::setAliasedProperties() in MappingFactory.php line 100
  10. at MappingFactory::fromArray() in MappingFactory.php line 81
  11. at MappingFactory::fromClass() in Mapper.php line 23
  12. at Mapper->buildMapping() in Mapper.php line 36
  13. at Mapper->__construct() in Laravel51Provider.php line 29
  14. at Laravel51Provider->NilPortugues\Laravel5\JsonApi\Providers\{closure}() in Container.php line 731
  15. at Container->build() in Container.php line 629
  16. at Container->make() in Application.php line 697
  17. at Application->make() in Container.php line 849
  18. at Container->resolveClass() in Container.php line 804
  19. at Container->getDependencies() in Container.php line 775
  20. at Container->build() in Container.php line 629
  21. at Container->make() in Application.php line 697
  22. at Application->make() in ControllerDispatcher.php line 67
  23. at ControllerDispatcher->makeController() in ControllerDispatcher.php line 52
  24. at ControllerDispatcher->dispatch() in Route.php line 174
  25. at Route->runController() in Route.php line 140
  26. at Route->run() in Router.php line 724
  27. at Router->Illuminate\Routing\{closure}() in Pipeline.php line 52
  28. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
  29. at Pipeline->Illuminate\Routing\{closure}() in VerifyCsrfToken.php line 64
  30. at VerifyCsrfToken->handle() in Pipeline.php line 136
  31. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  32. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  33. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  34. at Pipeline->Illuminate\Routing\{closure}() in ShareErrorsFromSession.php line 49
  35. at ShareErrorsFromSession->handle() in Pipeline.php line 136
  36. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  37. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  38. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  39. at Pipeline->Illuminate\Routing\{closure}() in StartSession.php line 64
  40. at StartSession->handle() in Pipeline.php line 136
  41. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  42. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  43. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  44. at Pipeline->Illuminate\Routing\{closure}() in AddQueuedCookiesToResponse.php line 37
  45. at AddQueuedCookiesToResponse->handle() in Pipeline.php line 136
  46. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  47. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  48. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  49. at Pipeline->Illuminate\Routing\{closure}() in EncryptCookies.php line 59
  50. at EncryptCookies->handle() in Pipeline.php line 136
  51. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  52. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  53. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  54. at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
  55. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
  56. at Pipeline->then() in Router.php line 726
  57. at Router->runRouteWithinStack() in Router.php line 699
  58. at Router->dispatchToRoute() in Router.php line 675
  59. at Router->dispatch() in Kernel.php line 246
  60. at Kernel->Illuminate\Foundation\Http\{closure}() in Pipeline.php line 52
  61. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
  62. at Pipeline->Illuminate\Routing\{closure}() in CheckForMaintenanceMode.php line 44
  63. at CheckForMaintenanceMode->handle() in Pipeline.php line 136
  64. at call_user_func_array:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
  65. at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
  66. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
  67. at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
  68. at call_user_func:{/home/vagrant/code/test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
  69. at Pipeline->then() in Kernel.php line 132
  70. at Kernel->sendRequestThroughRouter() in Kernel.php line 99
  71. at Kernel->handle() in index.php line 54
  72. at {main}() in index.php line 0

GET http://test.dev/employees vendor/nilportugues/laravel5-json-api/src/NilPortugues/Laravel5/JsonApi/Mapper/MappingFactory.php

line 35: $reflection = new ReflectionClass($className);

output:

object(ReflectionClass)[163] public 'name' => string 'App\Model\Database\Employees' (length=28) object(ReflectionClass)[205] public 'name' => string 'Illuminate\Database\Eloquent\Model' (length=34)

and error

novs commented 8 years ago

The problem was in DB connection. Solved.