Ich möchte meinem Konsolenbefehl doctrine:fixtures:load
eine neue Option hinzufügen.Neue Option zum LoadDataFixture-Befehl hinzufügen
class LoadDataFixturesCommand extends LoadDataFixturesDoctrineCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
$this->addOption('custom', null, InputOption::VALUE_OPTIONAL, 'Your Custom Option');
}
}
Als ich betreibe meine Befehl wie folgt aus:
Lehre: Leuchten: load --custom
ich diese Fehlermeldung bekommen:
[Symfony \ Component \ Console \ Exception \ RuntimeException]
Die Option "--custom" existiert nicht.
Wie kann ich diese Option zu meinem Konsolenbefehl hinzufügen?
Haben Sie 'symfony \ Component \ Console \ Input \ InputOption;' und 'symfony \ Component \ Console \ Input \ InputInterface;' in Ihrer Klasse 'LoadDataFixturesCommand' hinzugefügt? – Hokusai
Ja, alles hinzugefügt. So ist es nicht. Erklärungen sind in Ordnung, und die Fixtures-Klasse wurde bereits geladen. Die Nachricht kommt gleich danach. – Roland
Ich denke, dass diese Frage nützlich sein könnte: http://stackoverflow.com/questions/26596218/how-to-get-command-argument-outside-command-class – Hokusai