InputArgument example


    public function __construct(private readonly StateMachineRegistry $stateMachineRegistry)
    {
        parent::__construct();
    }

    protected function configure(): void
    {
        $this
            ->setDefinition([
                new InputArgument('name', InputArgument::REQUIRED, 'A state machine name'),
                new InputOption('label', 'l', InputOption::VALUE_REQUIRED, 'Labels a graph'),
            ])
            ->setHelp(
                <<<'EOF' The <info>%command.name%</info> command dumps the graphical representation of a workflow in different formats <info>DOT</info>: %command.full_name% <state machine name> | dot -Tpng > workflow.png EOF
            )
        ;
/** * @return list<array<string, mixed>> */
    private function fetchAllCarts(): array
    {
        return $this->connection->fetchAllAssociative('SELECT * FROM cart');
    }

    private function createInputDefinition(): InputDefinition
    {
        $type = new InputArgument('type', InputArgument::OPTIONAL);
        $days = new InputOption('days', null, InputOption::VALUE_REQUIRED);
        $all = new InputOption('all', null, InputOption::VALUE_NONE);

        return new InputDefinition([$type$days$all]);
    }

    private function fetchFirstIdFromTable(string $table): string
    {
        return Uuid::fromBytesToHex((string) $this->connection->fetchOne('SELECT id FROM ' . $table . ' LIMIT 1'));
    }

    
Home | Imprint | This part of the site doesn't use cookies.