Skip to content

Commit 7d67b7d

Browse files
committed
Commands
1 parent 8d02fc2 commit 7d67b7d

34 files changed

+201
-71
lines changed

code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
use Ibexa\Contracts\Core\Collection\ArrayMap;
1414
use Ibexa\Contracts\Core\Repository\PermissionResolver;
1515
use Ibexa\Contracts\Core\Repository\UserService;
16+
use Symfony\Component\Console\Attribute\AsCommand;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Output\OutputInterface;
2021

22+
#[AsCommand(
23+
name: 'app:action-configuration-create'
24+
)]
2125
final class ActionConfigurationCreateCommand extends Command
2226
{
23-
protected static $defaultName = 'app:action-configuration-create';
24-
2527
private ActionConfigurationServiceInterface $actionConfigurationService;
2628

2729
private PermissionResolver $permissionResolver;
@@ -39,12 +41,13 @@ public function __construct(
3941
ActionServiceInterface $actionService,
4042
ActionTypeRegistryInterface $actionTypeRegistry
4143
) {
42-
parent::__construct();
4344
$this->actionConfigurationService = $actionConfigurationService;
4445
$this->permissionResolver = $permissionResolver;
4546
$this->userService = $userService;
4647
$this->actionService = $actionService;
4748
$this->actionTypeRegistry = $actionTypeRegistry;
49+
50+
parent::__construct();
4851
}
4952

5053
protected function configure(): void

code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@
2222
use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
2323
use Ibexa\Core\FieldType\Image\Value;
2424
use Ibexa\Core\IO\IOBinarydataHandler;
25+
use Symfony\Component\Console\Attribute\AsCommand;
2526
use Symfony\Component\Console\Command\Command;
2627
use Symfony\Component\Console\Input\InputArgument;
2728
use Symfony\Component\Console\Input\InputInterface;
2829
use Symfony\Component\Console\Output\OutputInterface;
2930

31+
#[AsCommand(
32+
name: 'app:add-alt-text',
33+
)]
3034
final class AddMissingAltTextCommand extends Command
3135
{
32-
protected static $defaultName = 'app:add-alt-text';
33-
3436
private const IMAGE_FIELD_IDENTIFIER = 'image';
3537

3638
private ContentService $contentService;
@@ -53,13 +55,14 @@ public function __construct(
5355
ActionServiceInterface $actionService,
5456
IOBinarydataHandler $binaryDataHandler
5557
) {
56-
parent::__construct();
5758
$this->contentService = $contentService;
5859
$this->permissionResolver = $permissionResolver;
5960
$this->userService = $userService;
6061
$this->fieldTypeService = $fieldTypeService;
6162
$this->actionService = $actionService;
6263
$this->binaryDataHandler = $binaryDataHandler;
64+
65+
parent::__construct();
6366
}
6467

6568
protected function configure(): void

code_samples/api/commerce/src/Command/CartCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface;
1818
use Ibexa\Contracts\ProductCatalog\ProductServiceInterface;
1919
use Ibexa\Core\Repository\Permission\PermissionResolver;
20+
use Symfony\Component\Console\Attribute\AsCommand;
2021
use Symfony\Component\Console\Command\Command;
2122
use Symfony\Component\Console\Input\InputInterface;
2223
use Symfony\Component\Console\Output\OutputInterface;
2324

25+
#[AsCommand(
26+
name: 'doc:cart'
27+
)]
2428
final class CartCommand extends Command
2529
{
2630
private PermissionResolver $permissionResolver;
@@ -58,11 +62,7 @@ public function __construct(
5862
$this->reorderService = $reorderService;
5963
$this->cartResolver = $cartResolver;
6064

61-
parent::__construct('doc:cart');
62-
}
63-
64-
public function configure(): void
65-
{
65+
parent::__construct();
6666
}
6767

6868
protected function execute(InputInterface $input, OutputInterface $output): int

code_samples/api/commerce/src/Command/OrderCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
use Ibexa\Contracts\OrderManagement\Value\Struct\OrderCreateStruct;
2222
use Ibexa\Contracts\OrderManagement\Value\Struct\OrderUpdateStruct;
2323
use Money;
24+
use Symfony\Component\Console\Attribute\AsCommand;
2425
use Symfony\Component\Console\Command\Command;
2526
use Symfony\Component\Console\Input\InputInterface;
2627
use Symfony\Component\Console\Output\OutputInterface;
2728

29+
#[AsCommand(
30+
name: 'doc:order'
31+
)]
2832
final class OrderCommand extends Command
2933
{
3034
private PermissionResolver $permissionResolver;
@@ -42,14 +46,14 @@ public function __construct(
4246
$this->permissionResolver = $permissionResolver;
4347
$this->userService = $userService;
4448

45-
parent::__construct('doc:order');
49+
parent::__construct();
4650
}
4751

4852
public function configure(): void
4953
{
5054
}
5155

52-
protected function execute(InputInterface $input, OutputInterface $output)
56+
protected function execute(InputInterface $input, OutputInterface $output): int
5357
{
5458
$currentUser = $this->userService->loadUserByLogin('admin');
5559
$this->permissionResolver->setCurrentUserReference($currentUser);

code_samples/api/commerce/src/Command/PaymentCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
use Ibexa\Contracts\Payment\PaymentMethodServiceInterface;
1717
use Ibexa\Contracts\Payment\PaymentServiceInterface;
1818
use Money;
19+
use Symfony\Component\Console\Attribute\AsCommand;
1920
use Symfony\Component\Console\Command\Command;
2021
use Symfony\Component\Console\Input\InputInterface;
2122
use Symfony\Component\Console\Output\OutputInterface;
2223

24+
#[AsCommand(
25+
name: 'doc:payment'
26+
)]
2327
final class PaymentCommand extends Command
2428
{
2529
private PermissionResolver $permissionResolver;
@@ -45,14 +49,14 @@ public function __construct(
4549
$this->orderService = $orderService;
4650
$this->paymentMethodService = $paymentMethodService;
4751

48-
parent::__construct('doc:payment');
52+
parent::__construct();
4953
}
5054

5155
public function configure(): void
5256
{
5357
}
5458

55-
protected function execute(InputInterface $input, OutputInterface $output)
59+
protected function execute(InputInterface $input, OutputInterface $output): int
5660
{
5761
$currentUser = $this->userService->loadUserByLogin('admin');
5862
$this->permissionResolver->setCurrentUserReference($currentUser);

code_samples/api/commerce/src/Command/PaymentMethodCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Type;
1515
use Ibexa\Contracts\Payment\PaymentMethodServiceInterface;
1616
use Ibexa\Payment\Values\PaymentMethodType;
17+
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Output\OutputInterface;
2021

22+
#[AsCommand(
23+
name: 'doc:paymentMethod'
24+
)]
2125
final class PaymentMethodCommand extends Command
2226
{
2327
private PermissionResolver $permissionResolver;
@@ -31,14 +35,13 @@ public function __construct(
3135
UserService $userService,
3236
PaymentMethodServiceInterface $paymentMethodService
3337
) {
38+
parent::__construct();
3439
$this->paymentMethodService = $paymentMethodService;
3540
$this->permissionResolver = $permissionResolver;
3641
$this->userService = $userService;
37-
38-
parent::__construct('doc:paymentMethod');
3942
}
4043

41-
protected function execute(InputInterface $input, OutputInterface $output)
44+
protected function execute(InputInterface $input, OutputInterface $output): int
4245
{
4346
$currentUser = $this->userService->loadUserByLogin('admin');
4447
$this->permissionResolver->setCurrentUserReference($currentUser);

code_samples/api/commerce/src/Command/ShipmentCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
use Ibexa\Contracts\Shipping\ShipmentServiceInterface;
1818
use Ibexa\Contracts\Shipping\ShippingMethodServiceInterface;
1919
use Money;
20+
use Symfony\Component\Console\Attribute\AsCommand;
2021
use Symfony\Component\Console\Command\Command;
2122
use Symfony\Component\Console\Input\InputInterface;
2223
use Symfony\Component\Console\Output\OutputInterface;
2324

25+
#[AsCommand(
26+
name: 'doc:shipment'
27+
)]
2428
final class ShipmentCommand extends Command
2529
{
2630
private PermissionResolver $permissionResolver;
@@ -46,7 +50,7 @@ public function __construct(
4650
$this->shippingMethodService = $shippingMethodService;
4751
$this->orderService = $orderService;
4852

49-
parent::__construct('doc:shipment');
53+
parent::__construct();
5054
}
5155

5256
protected function execute(InputInterface $input, OutputInterface $output): int

code_samples/api/commerce/src/Command/ShippingMethodCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
use Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodQuery;
1414
use Ibexa\ProductCatalog\Local\Repository\Values\Region;
1515
use Ibexa\Shipping\Value\ShippingMethodType;
16+
use Symfony\Component\Console\Attribute\AsCommand;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputInterface;
1819
use Symfony\Component\Console\Output\OutputInterface;
1920

21+
#[AsCommand(
22+
name: 'doc:shippingMethod'
23+
)]
2024
final class ShippingMethodCommand extends Command
2125
{
2226
private PermissionResolver $permissionResolver;
@@ -38,7 +42,7 @@ public function __construct(
3842
$this->userService = $userService;
3943
$this->regionService = $regionService;
4044

41-
parent::__construct('doc:shippingMethod');
45+
parent::__construct();
4246
}
4347

4448
protected function execute(InputInterface $input, OutputInterface $output): int

code_samples/api/migration/src/Command/MigrationCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@
44

55
use Ibexa\Migration\MigrationService;
66
use Ibexa\Migration\Repository\Migration;
7+
use Symfony\Component\Console\Attribute\AsCommand;
78
use Symfony\Component\Console\Command\Command;
89
use Symfony\Component\Console\Input\InputInterface;
910
use Symfony\Component\Console\Output\OutputInterface;
1011

12+
#[AsCommand(
13+
name: 'doc:migration'
14+
)]
1115
final class MigrationCommand extends Command
1216
{
1317
private MigrationService $migrationService;
1418

1519
public function __construct(MigrationService $migrationService)
1620
{
1721
$this->migrationService = $migrationService;
18-
parent::__construct('doc:migration');
22+
23+
parent::__construct();
1924
}
2025

21-
protected function execute(InputInterface $input, OutputInterface $output)
26+
protected function execute(InputInterface $input, OutputInterface $output): int
2227
{
2328
$string_with_migration_content = '';
2429
$this->migrationService->add(

code_samples/api/product_catalog/src/Command/AttributeCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
use Ibexa\Contracts\ProductCatalog\AttributeTypeServiceInterface;
1010
use Ibexa\Contracts\ProductCatalog\Local\LocalAttributeDefinitionServiceInterface;
1111
use Ibexa\Contracts\ProductCatalog\Local\LocalAttributeGroupServiceInterface;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Output\OutputInterface;
1516

17+
#[AsCommand(
18+
name: 'doc:attributes'
19+
)]
1620
final class AttributeCommand extends Command
1721
{
1822
private AttributeGroupServiceInterface $attributeGroupService;
@@ -46,7 +50,7 @@ public function __construct(
4650
$this->userService = $userService;
4751
$this->permissionResolver = $permissionResolver;
4852

49-
parent::__construct('doc:attributes');
53+
parent::__construct();
5054
}
5155

5256
public function configure(): void

0 commit comments

Comments
 (0)