[make:entity] Allow specify the table name#1730
Open
omgslinux wants to merge 6 commits intosymfony:1.xfrom
Open
[make:entity] Allow specify the table name#1730omgslinux wants to merge 6 commits intosymfony:1.xfrom
omgslinux wants to merge 6 commits intosymfony:1.xfrom
Conversation
GromNaN
requested changes
Mar 18, 2026
Member
GromNaN
left a comment
There was a problem hiding this comment.
Aside from my preference regarding the signature of the generateEntityClass method, I think it's useful. It adds a question to the make:entity command, but the default answer makes it easy to skip.
Comment on lines
+210
to
+212
| params: [ | ||
| 'tableName' => $tableName, | ||
| ] |
Member
There was a problem hiding this comment.
I understand the intention, which is to stop adding parameters to the function and use an array instead. But in that case, we'd have to revise the entire method signature; this is just a stopgap solution.
Since the class is internal, I'm convinced that the best thing to do is to add a new parameter to the method. That way, it's clearly documented. Otherwise, we'd have to use an array-shape in the phpdoc, which is less strict.
Suggested change
| params: [ | |
| 'tableName' => $tableName, | |
| ] | |
| $tableName, |
| } | ||
|
|
||
| public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $apiResource, bool $withPasswordUpgrade = false, bool $generateRepositoryClass = true, bool $broadcast = false, EntityIdTypeEnum $useUuidIdentifier = EntityIdTypeEnum::INT): string | ||
| public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $apiResource, bool $withPasswordUpgrade = false, bool $generateRepositoryClass = true, bool $broadcast = false, EntityIdTypeEnum $useUuidIdentifier = EntityIdTypeEnum::INT, array $params = []): string |
Member
There was a problem hiding this comment.
Suggested change
| public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $apiResource, bool $withPasswordUpgrade = false, bool $generateRepositoryClass = true, bool $broadcast = false, EntityIdTypeEnum $useUuidIdentifier = EntityIdTypeEnum::INT, array $params = []): string | |
| public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $apiResource, bool $withPasswordUpgrade = false, bool $generateRepositoryClass = true, bool $broadcast = false, EntityIdTypeEnum $useUuidIdentifier = EntityIdTypeEnum::INT, string $tableName = ''): string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1626, here's a PR to fit that need. I've checked it's backwards compatible, so if you want to keep the current behaviour, you just have to confirm the default guessing. If you want to have a different table name from the default guessing, just enter when prompted. And I've tested that if you enter a keyword, it's properly quoted.