-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix ide-helper:models exception if model doesn't have factory #1196
Conversation
I tested locally and this PR works fine, why isn't approved yet? |
Sorry I can't respond to everything directly. There is an alternative PR open here: #1189 |
@mfn Is this good to merge? Would rather fix this issue before tagging a new version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't My models use the |
@wimski By default |
Yes, I get that the $factory = static::newFactory() ?: Factory::factoryForModel(get_called_class()); Currently the IDE helper determines the factory class in two ways:
Both options do not work in my situation. I do use custom namespacing for both models and factories (sub division), but I don't use the For example:
My factories work fine using this setup without having to specifically declare my custom namespace in |
😱 What shall we do 😄 @wimski do you want to attempt another PR to continue discussion there maybe? |
@wimski @mfn @barryvdh I suggest to move it to the config file to be able to customize your own namespace globally. // config file:
[
...
'factories_namespace' => null,
...
] // ModelsCommand.php
$factory = config('ide-helper.factories_namespace') ?: "\Database\Factories\\{$modelBaseName}Factory"; If this solution is appropriate. I will create another PR. |
I don't think that will solve anything. I'm working on my own PR to support both custom namespaces and namespaces that can be resolved by default.
|
Summary
fixes #1188
Checklist
composer fix-style