-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
minor: add $persistentManagerName param #450
minor: add $persistentManagerName param #450
Conversation
You mean on existing factories? I guess we should we update the maker/docs? |
yes, all existing factories will create an error with psalm if we make this move... We can update update maker and docs, but still, this could be pretty annoying... |
What about phpstan? |
even in max level, phpstan does not complain. But psalm is actually true: one param is missing in the methods prototype in the phpdoc |
Huh, well I don't want to not add a feature because it breaks static analysis, but that's just my opinion. |
What about starting a UPGRADE.md with a note for the next feature release? |
ok, this seems reasonable :) I feel the same, otherwise it would restrict too much further updates... see this issue as well #445 (comment) |
I think we need to have a This would remove the need for |
this seems not possible because I think this needs to be hardcoded directly in the class, and then have a factory class which is bound to a given manager. ex: class SomeFactoryForSpecificManager
{
protected static function getClass(): string
{
return SomeEntity::class;
}
protected static function getManagerName(): ?string
{
return 'specific-manager;
}
}
@kerstvo would this fix your problem? |
So
|
That's what I'm suggesting :) |
Since we're deprecating ModelFactory soon, maybe we should just add this feature to #452? We'll need to update some function parameters and the anon. proxy generator. |
I'm closing this PR, which targets 1.x and is full of conflicts. The issue stays opens, though |
fixes #447
I've not provided tests, because the code is trivial, but this would need to add a new document manager in the test 🤷
/cc @kerstvo
EDIT: I just realized that adding a param to
ModelFactory::repository()
will create an error in psalm in userland, because of the@phpstan-method
annotation 😞https://github.com/zenstruck/foundry/actions/runs/4707671150/jobs/8349671474?pr=450#step:8:18