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

Call to undefined method GeneaLabs\LaravelModelCaching\CachedBuilder::type() #391

Open
oulfr opened this issue Mar 5, 2021 · 5 comments
Assignees
Labels

Comments

@oulfr
Copy link

oulfr commented Mar 5, 2021

Describe the bug
not working in the last version of lumen and php 8
Eloquent Query
Please provide the complete eloquent query that caused the bug, for example:

    $articles = \App\Models\Article::find(12);

Stack Trace
Call to undefined method GeneaLabs\LaravelModelCaching\CachedBuilder::type() {"exception":"[object] (BadMethodCallException(code: 0)

Environment

  • PHP: 8.0
  • OS: Windows
  • Lumen: 8+
  • Model Caching: ^0.11.1
@mikebronner
Copy link
Owner

Hi @oulfr, Please provide the complete stack trace, to help me debug the problem. Thanks :)

@oulfr
Copy link
Author

oulfr commented Mar 5, 2021

I dont installed any cache provider i use the default cache configuration and this is the trace:

#0 D:\\workspace\\test\\vendor\\illuminate\\support\\Traits\\ForwardsCalls.php(36): Illuminate\\Database\\Eloquent\\Builder::throwBadMethodCallException('type')
#1 D:\\workspace\\test\\vendor\\illuminate\\database\\Eloquent\\Builder.php(1550): Illuminate\\Database\\Eloquent\\Builder->forwardCallTo(Object(Illuminate\\Database\\Query\\Builder), 'type', Array)
#2 D:\\workspace\\test\\vendor\\genealabs\\laravel-model-caching\\src\\Traits\\Caching.php(22): Illuminate\\Database\\Eloquent\\Builder->__call('type', Array)
#3 D:\\workspace\\test\\vendor\\jgrossi\\corcel\\src\\Model\\Post.php(172): GeneaLabs\\LaravelModelCaching\\CachedBuilder->__call('type', Array)
#4 D:\\workspace\\test\\vendor\\illuminate\\database\\Eloquent\\Model.php(1885): Corcel\\Model\\Post->newQuery()
#5 D:\\workspace\\test\\vendor\\genealabs\\laravel-model-caching\\src\\Traits\\Caching.php(22): Illuminate\\Database\\Eloquent\\Model->__call('find', Array)
#6 D:\\workspace\\test\\vendor\\illuminate\\database\\Eloquent\\Model.php(1897): App\\Models\\Article->__call('find', Array)
#7 D:\\workspace\\api\
outes\\web.php(29): Illuminate\\Database\\Eloquent\\Model::__callStatic('find', Array)
#8 D:\\workspace\\test\\vendor\\illuminate\\container\\BoundMethod.php(36): Closure->{closure}('cache')
#9 D:\\workspace\\test\\vendor\\illuminate\\container\\Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 D:\\workspace\\test\\vendor\\illuminate\\container\\BoundMethod.php(81): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#11 D:\\workspace\\test\\vendor\\illuminate\\container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Laravel\\Lumen\\Application), Object(Closure), Object(Closure))
#12 D:\\workspace\\test\\vendor\\illuminate\\container\\Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Laravel\\Lumen\\Application), Object(Closure), Array, NULL)
#13 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(299): Illuminate\\Container\\Container->call(Object(Closure), Array)
#14 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(259): Laravel\\Lumen\\Application->callActionOnArrayBasedRoute(Array)
#15 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(48): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#16 D:\\workspace\\test\\app\\Http\\Middleware\\Authenticate.php(43): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#17 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(167): App\\Http\\Middleware\\Authenticate->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure), 'api')
#18 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#19 D:\\workspace\\test\\app\\Http\\Middleware\\ThrottleRequests.php(127): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#20 D:\\workspace\\test\\app\\Http\\Middleware\\ThrottleRequests.php(63): App\\Http\\Middleware\\ThrottleRequests->handleRequest(Object(Laravel\\Lumen\\Http\\Request), Object(Closure), Array)
#21 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(167): App\\Http\\Middleware\\ThrottleRequests->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure), '60000')
#22 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#23 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(103): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#24 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(423): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#25 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(260): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#26 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(234): Laravel\\Lumen\\Application->handleFoundRoute(Array)
#27 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(170): Laravel\\Lumen\\Application->handleDispatcherResponse(Array)
#28 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(48): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#29 D:\\workspace\\test\\app\\Http\\Middleware\\ChangeLocale.php(26): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#30 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(167): App\\Http\\Middleware\\ChangeLocale->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#31 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#32 D:\\workspace\\test\\app\\Http\\Middleware\\RequestsAcceptJson.php(24): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#33 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(167): App\\Http\\Middleware\\RequestsAcceptJson->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#34 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#35 D:\\workspace\\test\\vendor\\fruitcake\\laravel-cors\\src\\HandleCors.php(37): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#36 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#37 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Routing\\Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#38 D:\\workspace\\test\\vendor\\illuminate\\pipeline\\Pipeline.php(103): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#39 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(423): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#40 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(172): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#41 D:\\workspace\\test\\vendor\\laravel\\lumen-framework\\src\\Concerns\\RoutesRequests.php(109): Laravel\\Lumen\\Application->dispatch(NULL)
#42 D:\\workspace\\test\\public\\index.php(28): Laravel\\Lumen\\Application->run()
#43 {main}
"}

@mikebronner
Copy link
Owner

@oulfr Thanks for the follow-up with the additional details. I'll try to look into it the weekend, time permitting. :)

@oulfr
Copy link
Author

oulfr commented Mar 5, 2021

Ok so i found what is the problem i use the jgrossi/corcel that had a custom PostBuilder, so you can close it.

@oulfr
Copy link
Author

oulfr commented Mar 5, 2021

Thank you for this great extension, i think every project need it, so i resolved my issue with @backstageel method:

#275 (comment)

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

No branches or pull requests

2 participants