Skip to content

Commit 4ade0f0

Browse files
committed
fix(command): add attributes support
1 parent 6868622 commit 4ade0f0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Command/CreateCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
namespace ACSEO\TypesenseBundle\Command;
66

77
use ACSEO\TypesenseBundle\Manager\CollectionManager;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89
use Symfony\Component\Console\Command\Command;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112

13+
#[AsCommand(
14+
name: 'typesense:create',
15+
)]
1216
class CreateCommand extends Command
1317
{
14-
protected static $defaultName = 'typesense:create';
1518
private $collectionManager;
1619

1720
public function __construct(CollectionManager $collectionManager)
@@ -23,7 +26,6 @@ public function __construct(CollectionManager $collectionManager)
2326
protected function configure()
2427
{
2528
$this
26-
->setName(self::$defaultName)
2729
->setDescription('Create Typsenses indexes')
2830

2931
;

src/Command/ImportCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
use ACSEO\TypesenseBundle\Manager\DocumentManager;
99
use ACSEO\TypesenseBundle\Transformer\DoctrineToTypesenseTransformer;
1010
use Doctrine\ORM\EntityManagerInterface;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Command\Command;
1213
use Symfony\Component\Console\Input\InputInterface;
1314
use Symfony\Component\Console\Input\InputOption;
1415
use Symfony\Component\Console\Output\OutputInterface;
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617

18+
#[AsCommand(
19+
name: 'typesense:import',
20+
)]
1721
class ImportCommand extends Command
1822
{
19-
protected static $defaultName = 'typesense:import';
20-
2123
private $em;
2224
private $collectionManager;
2325
private $documentManager;
@@ -45,7 +47,6 @@ public function __construct(
4547
protected function configure()
4648
{
4749
$this
48-
->setName(self::$defaultName)
4950
->setDescription('Import collections from Database')
5051
->addOption('action', null, InputOption::VALUE_OPTIONAL, 'Action modes for typesense import ("create", "upsert" or "update")', 'upsert')
5152
;

0 commit comments

Comments
 (0)