Skip to content

Commit eeaf223

Browse files
committed
Making the user message a little nicer
1 parent f308d92 commit eeaf223

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Maker/MakeEntity.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ public function afterGenerate(ConsoleStyle $io, array $params)
184184

185185
$manipulator = $this->createClassManipulator($params['entity_path'], $io, $overwrite);
186186

187+
$isFirstField = true;
187188
while (true) {
188-
$newField = $this->askForNextField($io, $currentFields, $params['entity_full_class_name']);
189+
$newField = $this->askForNextField($io, $currentFields, $params['entity_full_class_name'], $isFirstField);
190+
$isFirstField = false;
189191

190192
if (null === $newField) {
191193
break;
@@ -301,10 +303,17 @@ public function configureDependencies(DependencyBuilder $dependencies)
301303
);
302304
}
303305

304-
private function askForNextField(ConsoleStyle $io, array $fields, string $entityClass)
306+
private function askForNextField(ConsoleStyle $io, array $fields, string $entityClass, bool $isFirstField)
305307
{
306308
$io->writeln('');
307-
$fieldName = $io->ask('New property name (press <return> to stop adding fields)', null, function ($name) use ($fields) {
309+
310+
if ($isFirstField) {
311+
$questionText = 'New property name (press <return> to stop adding fields)';
312+
} else {
313+
$questionText = 'Add another property? Enter the property name (or press <return> to stop adding fields)';
314+
}
315+
316+
$fieldName = $io->ask($questionText, null, function ($name) use ($fields) {
308317
// allow it to be empty
309318
if (!$name) {
310319
return $name;

0 commit comments

Comments
 (0)