Skip to content

[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
symfony:1.xfrom
Amoifr:fix/with-uuid-ignored-with-name-arg
Open

[make:entity] Fix --with-uuid and --with-ulid being ignored when name is passed as argument#1795
Amoifr wants to merge 1 commit into
symfony:1.xfrom
Amoifr:fix/with-uuid-ignored-with-name-arg

Conversation

@Amoifr
Copy link
Copy Markdown
Contributor

@Amoifr Amoifr commented May 12, 2026

Summary

When the entity name is provided as a command argument, MakeEntity::interact() returns early before reaching $this->checkIsUsingUid($input). The $usesUuid / $usesUlid flags are therefore never set, and the entity is always generated with an integer id — silently ignoring --with-uuid / --with-ulid.

# Before this PR: id is int, options silently ignored
php bin/console make:entity MyEntity --with-uuid

The fix moves the call to the top of interact(), which:

  • Matches the pattern already used in MakeUser::interact() and MakeResetPassword::interact().
  • Matches the docblock in UidTrait::checkIsUsingUid(): "Call this as early as possible in a maker's interact()."
  • Also surfaces the existing validation (mutually-exclusive --with-uuid / --with-ulid, missing symfony/uid) earlier in non-interactive flows.

Test plan

  • New regression test it_creates_a_new_class_with_uuid_when_name_is_passed_as_argument exercises make:entity User --with-uuid and asserts the generated entity uses Uuid + doctrine.uuid_generator.
  • PHP-CS-Fixer dry-run clean on touched files.
  • Existing UUID/ULID tests reach the same code paths as before.

Fixes #1789

… 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
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.

--with-uuid and --with-ulid options ignored when entity name provided as argument

1 participant