Skip to content

Make:entity requires Mercure too soon #1481

@smnandre

Description

@smnandre

The recent #1445 introduced a bug (as raised here)

This check should be done only if the user answer "YES" to the question.

  if (
      !$input->getOption('broadcast')
      && class_exists(Broadcast::class)
      && !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
  ) {
      // Mercure is needed
      if (!class_exists(MercureExtension::class)) {
          throw new RuntimeCommandException('Please run "composer require symfony/mercure". It is needed to broadcast entities.');
      }

      $description = $command->getDefinition()->getOption('broadcast')->getDescription();
      $question = new ConfirmationQuestion($description, false);
      $isBroadcast = $io->askQuestion($question);
      $input->setOption('broadcast', $isBroadcast);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions