diff --git a/src/Command/CreateCommand.php b/src/Command/CreateCommand.php index 1b850ba..91872b5 100644 --- a/src/Command/CreateCommand.php +++ b/src/Command/CreateCommand.php @@ -5,15 +5,18 @@ namespace ACSEO\TypesenseBundle\Command; use ACSEO\TypesenseBundle\Manager\CollectionManager; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand( + name: 'typesense:create', +)] class CreateCommand extends Command { - protected static $defaultName = 'typesense:create'; private $collectionManager; public function __construct(CollectionManager $collectionManager) diff --git a/src/Command/ImportCommand.php b/src/Command/ImportCommand.php index 0aedef8..059999c 100644 --- a/src/Command/ImportCommand.php +++ b/src/Command/ImportCommand.php @@ -8,16 +8,18 @@ use ACSEO\TypesenseBundle\Manager\DocumentManager; use ACSEO\TypesenseBundle\Transformer\DoctrineToTypesenseTransformer; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand( + name: 'typesense:import', +)] class ImportCommand extends Command { - protected static $defaultName = 'typesense:import'; - private $em; private $collectionManager; private $documentManager; @@ -45,7 +47,6 @@ public function __construct( protected function configure() { $this - ->setName(self::$defaultName) ->setDescription('Import collections from Database') ->addOption('action', null, InputOption::VALUE_OPTIONAL, 'Action modes for typesense import ("create", "upsert" or "update")', 'upsert') ->addOption('indexes', null, InputOption::VALUE_OPTIONAL, 'The index(es) to repopulate. Comma separated values')