Skip to content

Commit d6c64dc

Browse files
authored
Beispiel Console Funktion ergänzt
Ohne die Anpassung wird dieser Fehler erzeugt: PHP Fatal error: Declaration of myclass::execute() must be compatible with Symfony\Component\Console\Command\Command::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) in ...
1 parent 24494ff commit d6c64dc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

console.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,14 @@ Optionen:
170170
Die Ausführung eines Konsolen-Befehls erfordert eine eigene Klasse, die auf `rex_console_command` aufbaut und den ausführbaren Code selbst enthält bzw. aufruft. In dieser Klasse muss es eine Methode `execute` geben. Die einfachste Form sieht etwa so aus:
171171

172172
```php
173+
use Symfony\Component\Console\Input\InputInterface;
174+
use Symfony\Component\Console\Input\InputOption;
175+
use Symfony\Component\Console\Output\OutputInterface;
176+
173177
class mein_console_befehl extends rex_console_command {
174-
protected function execute() {
178+
protected function execute(InputInterface $input, OutputInterface $output): int
175179
echo "hallo redaxo"; // beliebiges php hier
180+
return 0;
176181
}
177182
}
178183
```

0 commit comments

Comments
 (0)