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

[8.x] Fix autoresolving model name from factory #40616

Merged
merged 3 commits into from
Jan 27, 2022

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented Jan 25, 2022

At the moment, a factory can't auto-resolve namespaced models which are nested inside the models directory and have coresponding Factory classes at the same location. You can reproduce this with the issue at #40614

By changing the code here to take into account the nested namespace for factory classes, we can auto resort the model name without having to define the $model class on the factory.

One thing I'm not sure off is that if we should just fallback on the model classname without the namespace for the last part here (as it was before):

: $appNamespace.$factoryBasename;

I can adjust the code for that if you like.

Fixes #40614

@driesvints driesvints changed the title Fix autoresolving model name from factory [8.x] Fix autoresolving model name from factory Jan 25, 2022
@driesvints driesvints marked this pull request as ready for review January 25, 2022 14:04
@taylorotwell taylorotwell marked this pull request as draft January 25, 2022 15:05
@driesvints driesvints marked this pull request as ready for review January 27, 2022 11:15
@taylorotwell taylorotwell merged commit da28a53 into 8.x Jan 27, 2022
@taylorotwell taylorotwell deleted the fix-auto-resolve-model-name branch January 27, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A nested Model can resolve its Factory, but the resolved nested Factory can't resolve its Model
2 participants