-
Notifications
You must be signed in to change notification settings - Fork 11.4k
illuminate/database exception #36050
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
Comments
Heya. I don't see |
Because in case of Lumen we don't use Illuminate\Foundation\Application
Use abstract not concrete )) In case packages are used in both frameworks (Lumen + Laravel) |
If you need to use those factories please use Laravel instead. |
If you think that factories shouldn't be used in Lumen... Then it's up to you. |
Okay, I've just tried on a fresh Lumen install and factories are working fine for me. So I'm not sure if it's related to anything specific to your setup? |
The same trouble with lumen 8.2.1 and 8.2.2. |
@vborduja maybe you should stop downvoting my comments and give me a proper way to reproduce this? |
It's works )) Because it's in try - catch block. And it's returns App
also change namespaces to new one, for making it works in bootstrap/app.php ( App -> AppTest)
will return App\\ And there will 500 error Class 'Database\Factories\AppTest\Models\UserFactory' not found But if we will use Contracts in Factory use Illuminate\Contracts\Foundation\Application; then there will no be error. Actually I think its just TYPO because everywhere in framework you use |
We don't support moving the app directory and we don't recommend changing the default namespace, sorry. |
@driesvints You are right, there is no direct harm as App\
namespace is default for laravel|lumen applications.
In our case, actual issue was the terrible performance degradation of our tests due to bad setup of xdebug in laradock on windows (wsl2).
In short:
- Every time
Model::factory()
is used - theFactory::appNamespace()
is called in background. Factory::appNamespace()
requestsIlluminate\Foundation\Application
from the container- As lumen app is linked to laravel contract
Illuminate\Contracts\Foundation\Application
, container was throwing theBindingResolutionException
. - Due to the laradock performance issues -
xdebug
was spending ~4 secs on processing every exception being thrown. - As final result the initial database seeding for our tests was taking up to 2 hours.
We fixed our problem by tweaking laradock setup, but during investigation was found that Factory
accidentally uses direct application FQCN while illuminate contract should be used.
I've created a PR with the fix #36089
To be perfectly clear: I'm not opposed to the change to the contract itself. I'm just saying that we don't recommend changing the app directory or the namespace. |
Description:
Im not using laravel, using lumen. But this problem related to package we all use
illuminate/database version 8.24
Illuminate\Database\Eloquent\Factories\Factory
Use
use Illuminate\Contracts\Application;
instead of
Illuminate\Contracts\Foundation\Application;
this exception in try catch block - but i don't see reason not to using correct namespace
Steps To Reproduce:
File: \vendor\illuminate\database\Eloquent\Factories\Factory.php
The text was updated successfully, but these errors were encountered: