[make:entity] Fix --with-uuid and --with-ulid being ignored when name is passed as argument#1795
Open
Amoifr wants to merge 1 commit into
Open
[make:entity] Fix --with-uuid and --with-ulid being ignored when name is passed as argument#1795Amoifr wants to merge 1 commit into
--with-uuid and --with-ulid being ignored when name is passed as argument#1795Amoifr wants to merge 1 commit into
Conversation
… is passed as argument
When the entity name was provided as a command argument, interact() returned
early before reaching checkIsUsingUid(), so the $usesUuid / $usesUlid flags
were never set and the entity was always generated with an integer id.
Moving the call to the top of interact() matches the pattern already used in
MakeUser and MakeResetPassword, and the docblock in UidTrait::checkIsUsingUid
("Call this as early as possible in a maker's interact()").
Fixes symfony#1789
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.
Summary
When the entity name is provided as a command argument,
MakeEntity::interact()returns early before reaching$this->checkIsUsingUid($input). The$usesUuid/$usesUlidflags are therefore never set, and the entity is always generated with an integerid— silently ignoring--with-uuid/--with-ulid.# Before this PR: id is int, options silently ignored php bin/console make:entity MyEntity --with-uuidThe fix moves the call to the top of
interact(), which:MakeUser::interact()andMakeResetPassword::interact().UidTrait::checkIsUsingUid(): "Call this as early as possible in a maker's interact()."--with-uuid/--with-ulid, missingsymfony/uid) earlier in non-interactive flows.Test plan
it_creates_a_new_class_with_uuid_when_name_is_passed_as_argumentexercisesmake:entity User --with-uuidand asserts the generated entity usesUuid+doctrine.uuid_generator.Fixes #1789