Skip to content

[make:entity] ask() doesnt accept "int" only "string" #1503

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

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Maker/MakeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,13 @@ private function askForNextField(ConsoleStyle $io, array $fields, string $entity

if ('string' === $type) {
// default to 255, avoid the question
$classProperty->length = $io->ask('Field length', 255, Validator::validateLength(...));
$classProperty->length = $io->ask('Field length', '255', Validator::validateLength(...));
} elseif ('decimal' === $type) {
// 10 is the default value given in \Doctrine\DBAL\Schema\Column::$_precision
$classProperty->precision = $io->ask('Precision (total number of digits stored: 100.00 would be 5)', 10, Validator::validatePrecision(...));
$classProperty->precision = $io->ask('Precision (total number of digits stored: 100.00 would be 5)', '10', Validator::validatePrecision(...));

// 0 is the default value given in \Doctrine\DBAL\Schema\Column::$_scale
$classProperty->scale = $io->ask('Scale (number of decimals to store: 100.00 would be 2)', 0, Validator::validateScale(...));
$classProperty->scale = $io->ask('Scale (number of decimals to store: 100.00 would be 2)', '0', Validator::validateScale(...));
}

if ($io->confirm('Can this field be null in the database (nullable)', false)) {
Expand Down