From b68b4564dfd0fa5d4a825d7025664087223db201 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 28 Sep 2022 13:59:33 +0200 Subject: [PATCH] Imrove feedback --- src/EntityBuilder/AbstractEntityCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/EntityBuilder/AbstractEntityCommand.php b/src/EntityBuilder/AbstractEntityCommand.php index 08c6dbf..2debeb4 100644 --- a/src/EntityBuilder/AbstractEntityCommand.php +++ b/src/EntityBuilder/AbstractEntityCommand.php @@ -45,6 +45,7 @@ abstract class AbstractEntityCommand extends Command $this->getConfig($builder); if ($input->getOption('create')) { + $io->info(sprintf('Creating new "%s"', $this->getEntityClass())); $entity = new ($this->getEntityClass())(); $builder->setAll($entity); @@ -52,9 +53,11 @@ abstract class AbstractEntityCommand extends Command $io->success(sprintf('Object "%s" (id: %s) stored successfully', $entity, $entity->getId())); } } elseif ($input->getOption('modify')) { + $io->info(sprintf('Modifying "%s"', $this->getEntityClass())); $entity = $this->select($io, $id); $builder->setByQuestion($entity); } elseif ($input->getOption('delete')) { + $io->info(sprintf('Deleting "%s"', $this->getEntityClass())); $entity = $this->select($io, $id); if ($io->askQuestion(new ConfirmationQuestion(sprintf('Are you sure you want to delete %s', $entity)))) { $name = (string)$entity; @@ -62,6 +65,7 @@ abstract class AbstractEntityCommand extends Command $io->success(sprintf('Config "%s" deleted', $name)); } } elseif ($input->getOption('show')) { + $io->info(sprintf('Showing "%s"', $this->getEntityClass())); $entity = $this->select($io, $id); $table = $io->createTable(); $table->setHeaders(['property', 'value']); @@ -69,8 +73,8 @@ abstract class AbstractEntityCommand extends Command $table->setHeaderTitle(sprintf('id: %s', $entity->getId())); $table->render(); } else { - $io->error('Select at least one of the options'); - return Command::FAILURE; + $io->error('Select at least one of the options: Create (-c), Modify (-m), Delete (-d) or Show (-s)'); + return Command::INVALID; } $this->em->persist($entity);