Skip to content

Commit

Permalink
Merge pull request #86 from dkarlovi/command
Browse files Browse the repository at this point in the history
fix: rename the Symfony command to "xezilaires:serialize"
  • Loading branch information
dkarlovi committed Sep 11, 2019
2 parents 6383afd + 131676b commit 1225c64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Xezilaires/Bridge/Symfony/Command/SerializeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class SerializeCommand extends Command
/**
* @var string
*/
protected static $defaultName = 'serialize';
protected static $defaultName = 'xezilaires:serialize';

/**
* @var SpreadsheetIteratorFactory
Expand All @@ -42,7 +42,7 @@ final class SerializeCommand extends Command

public function __construct(SpreadsheetIteratorFactory $iteratorFactory, Serializer $serializer)
{
parent::__construct('serialize');
parent::__construct('xezilaires:serialize');

$this->setDescription('Serialize Excel files into JSON, XML, CSV');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Xezilaires\Bridge\Symfony\Command\SerializeCommand;

/**
* @internal
Expand All @@ -39,6 +41,19 @@ public function process(ContainerBuilder $container): void
if (0 !== mb_strpos($className, 'Xezilaires')) {
$container->removeDefinition($id);
}

if ($className === SerializeCommand::class) {
$arguments = $definition->getArguments();

$definition = new Definition($className);
$definition->setArguments($arguments);
$definition->addTag('console.command', [
'command' => 'serialize',
]);
$container->addDefinitions([
$id => $definition,
]);
}
}
}
}

0 comments on commit 1225c64

Please sign in to comment.