我在 symfony3 上有一个大项目。在这个项目中,我有 ProjectFrameworkBundle。
项目/FrameworkBundle/Console/Command.php
abstract class Command extends ContainerAwareCommand
{
//...
protected function execute(InputInterface $input, OutputInterface $output)
{
// do some regular staff
$exitCode = $this->executeCommand($input, $output);
// do some regular staff
}
abstract protected function executeCommand(InputInterface $input, OutputInterface $output);
//...
}
Run Code Online (Sandbox Code Playgroud)
如果我要从 Command 类扩展任何命令,它将正常工作(已测试)。
但是,我还有一个包
项目/FrameworkQueue/控制台/Command.php
use Project\FrameworkBundle\Console\Command as BaseCommand;
abstract class Command extends BaseCommand
{
// ...
protected function executeCommand(InputInterface $input, OutputInterface $output)
{
// do some regular staff
$exitCode = $this->executeJob($input, $output);
// do some regular …
Run Code Online (Sandbox Code Playgroud)