diff --git a/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php b/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php index 644dc26467..cb7ce9bc29 100644 --- a/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php +++ b/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php @@ -13,15 +13,17 @@ use Ibexa\Contracts\Core\Collection\ArrayMap; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'app:action-configuration-create' +)] final class ActionConfigurationCreateCommand extends Command { - protected static $defaultName = 'app:action-configuration-create'; - private ActionConfigurationServiceInterface $actionConfigurationService; private PermissionResolver $permissionResolver; @@ -39,12 +41,13 @@ public function __construct( ActionServiceInterface $actionService, ActionTypeRegistryInterface $actionTypeRegistry ) { - parent::__construct(); $this->actionConfigurationService = $actionConfigurationService; $this->permissionResolver = $permissionResolver; $this->userService = $userService; $this->actionService = $actionService; $this->actionTypeRegistry = $actionTypeRegistry; + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php b/code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php index 0d527b8c44..84928aab61 100644 --- a/code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php +++ b/code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php @@ -22,15 +22,17 @@ use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Core\FieldType\Image\Value; use Ibexa\Core\IO\IOBinarydataHandler; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'app:add-alt-text', +)] final class AddMissingAltTextCommand extends Command { - protected static $defaultName = 'app:add-alt-text'; - private const IMAGE_FIELD_IDENTIFIER = 'image'; private ContentService $contentService; @@ -53,13 +55,14 @@ public function __construct( ActionServiceInterface $actionService, IOBinarydataHandler $binaryDataHandler ) { - parent::__construct(); $this->contentService = $contentService; $this->permissionResolver = $permissionResolver; $this->userService = $userService; $this->fieldTypeService = $fieldTypeService; $this->actionService = $actionService; $this->binaryDataHandler = $binaryDataHandler; + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/commerce/src/Command/CartCommand.php b/code_samples/api/commerce/src/Command/CartCommand.php index 102440bc9b..aedfb50589 100644 --- a/code_samples/api/commerce/src/Command/CartCommand.php +++ b/code_samples/api/commerce/src/Command/CartCommand.php @@ -17,10 +17,14 @@ use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface; use Ibexa\Contracts\ProductCatalog\ProductServiceInterface; use Ibexa\Core\Repository\Permission\PermissionResolver; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:cart' +)] final class CartCommand extends Command { private PermissionResolver $permissionResolver; @@ -58,11 +62,7 @@ public function __construct( $this->reorderService = $reorderService; $this->cartResolver = $cartResolver; - parent::__construct('doc:cart'); - } - - public function configure(): void - { + parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/code_samples/api/commerce/src/Command/OrderCommand.php b/code_samples/api/commerce/src/Command/OrderCommand.php index 85059aae61..904ff231ee 100644 --- a/code_samples/api/commerce/src/Command/OrderCommand.php +++ b/code_samples/api/commerce/src/Command/OrderCommand.php @@ -21,10 +21,14 @@ use Ibexa\Contracts\OrderManagement\Value\Struct\OrderCreateStruct; use Ibexa\Contracts\OrderManagement\Value\Struct\OrderUpdateStruct; use Money; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:order' +)] final class OrderCommand extends Command { private PermissionResolver $permissionResolver; @@ -42,14 +46,14 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->userService = $userService; - parent::__construct('doc:order'); + parent::__construct(); } public function configure(): void { } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Command/PaymentCommand.php b/code_samples/api/commerce/src/Command/PaymentCommand.php index f18b0b6115..d7f98eeb6e 100644 --- a/code_samples/api/commerce/src/Command/PaymentCommand.php +++ b/code_samples/api/commerce/src/Command/PaymentCommand.php @@ -16,10 +16,14 @@ use Ibexa\Contracts\Payment\PaymentMethodServiceInterface; use Ibexa\Contracts\Payment\PaymentServiceInterface; use Money; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:payment' +)] final class PaymentCommand extends Command { private PermissionResolver $permissionResolver; @@ -45,14 +49,14 @@ public function __construct( $this->orderService = $orderService; $this->paymentMethodService = $paymentMethodService; - parent::__construct('doc:payment'); + parent::__construct(); } public function configure(): void { } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); @@ -67,6 +71,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $paymentIdentifier = '4ac4b8a0-eed8-496d-87d9-32a960a10629'; $payment = $this->paymentService->getPaymentByIdentifier($paymentIdentifier); + $context = $payment->getContext(); + // Will be overridden later but used to illustrate `getContext()` + $output->writeln(sprintf('Your payment for transaction has status %s', $payment->getStatus())); // Query for payments diff --git a/code_samples/api/commerce/src/Command/PaymentMethodCommand.php b/code_samples/api/commerce/src/Command/PaymentMethodCommand.php index d53ab08575..0d26d03de0 100644 --- a/code_samples/api/commerce/src/Command/PaymentMethodCommand.php +++ b/code_samples/api/commerce/src/Command/PaymentMethodCommand.php @@ -14,10 +14,14 @@ use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Type; use Ibexa\Contracts\Payment\PaymentMethodServiceInterface; use Ibexa\Payment\Values\PaymentMethodType; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:paymentMethod' +)] final class PaymentMethodCommand extends Command { private PermissionResolver $permissionResolver; @@ -35,10 +39,10 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->userService = $userService; - parent::__construct('doc:paymentMethod'); + parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Command/ShipmentCommand.php b/code_samples/api/commerce/src/Command/ShipmentCommand.php index 89b384d24b..35dbfe7dfc 100644 --- a/code_samples/api/commerce/src/Command/ShipmentCommand.php +++ b/code_samples/api/commerce/src/Command/ShipmentCommand.php @@ -17,10 +17,14 @@ use Ibexa\Contracts\Shipping\ShipmentServiceInterface; use Ibexa\Contracts\Shipping\ShippingMethodServiceInterface; use Money; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:shipment' +)] final class ShipmentCommand extends Command { private PermissionResolver $permissionResolver; @@ -46,7 +50,7 @@ public function __construct( $this->shippingMethodService = $shippingMethodService; $this->orderService = $orderService; - parent::__construct('doc:shipment'); + parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/code_samples/api/commerce/src/Command/ShippingMethodCommand.php b/code_samples/api/commerce/src/Command/ShippingMethodCommand.php index 34f3d646e8..23f25286f9 100644 --- a/code_samples/api/commerce/src/Command/ShippingMethodCommand.php +++ b/code_samples/api/commerce/src/Command/ShippingMethodCommand.php @@ -13,10 +13,14 @@ use Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodQuery; use Ibexa\ProductCatalog\Local\Repository\Values\Region; use Ibexa\Shipping\Value\ShippingMethodType; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:shippingMethod' +)] final class ShippingMethodCommand extends Command { private PermissionResolver $permissionResolver; @@ -38,7 +42,7 @@ public function __construct( $this->userService = $userService; $this->regionService = $regionService; - parent::__construct('doc:shippingMethod'); + parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/code_samples/api/migration/src/Command/MigrationCommand.php b/code_samples/api/migration/src/Command/MigrationCommand.php index 848f54742a..862170007a 100644 --- a/code_samples/api/migration/src/Command/MigrationCommand.php +++ b/code_samples/api/migration/src/Command/MigrationCommand.php @@ -4,10 +4,14 @@ use Ibexa\Migration\MigrationService; use Ibexa\Migration\Repository\Migration; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:migration' +)] final class MigrationCommand extends Command { private MigrationService $migrationService; @@ -15,10 +19,11 @@ final class MigrationCommand extends Command public function __construct(MigrationService $migrationService) { $this->migrationService = $migrationService; - parent::__construct('doc:migration'); + + parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $string_with_migration_content = ''; $this->migrationService->add( diff --git a/code_samples/api/product_catalog/src/Command/AttributeCommand.php b/code_samples/api/product_catalog/src/Command/AttributeCommand.php index 1833476e93..609238328d 100644 --- a/code_samples/api/product_catalog/src/Command/AttributeCommand.php +++ b/code_samples/api/product_catalog/src/Command/AttributeCommand.php @@ -9,10 +9,14 @@ use Ibexa\Contracts\ProductCatalog\AttributeTypeServiceInterface; use Ibexa\Contracts\ProductCatalog\Local\LocalAttributeDefinitionServiceInterface; use Ibexa\Contracts\ProductCatalog\Local\LocalAttributeGroupServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:attributes' +)] final class AttributeCommand extends Command { private AttributeGroupServiceInterface $attributeGroupService; @@ -46,7 +50,7 @@ public function __construct( $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:attributes'); + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/CatalogCommand.php b/code_samples/api/product_catalog/src/Command/CatalogCommand.php index c3dabd6008..800aa3deae 100644 --- a/code_samples/api/product_catalog/src/Command/CatalogCommand.php +++ b/code_samples/api/product_catalog/src/Command/CatalogCommand.php @@ -13,11 +13,15 @@ use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; use Ibexa\ProductCatalog\Local\Repository\Values\Catalog\Status; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:catalog' +)] final class CatalogCommand extends Command { private UserService $userService; @@ -38,7 +42,8 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->productService = $productService; $this->catalogService = $catalogService; - parent::__construct('doc:catalog'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/CurrencyCommand.php b/code_samples/api/product_catalog/src/Command/CurrencyCommand.php index 16c6400adf..04f11d6d49 100644 --- a/code_samples/api/product_catalog/src/Command/CurrencyCommand.php +++ b/code_samples/api/product_catalog/src/Command/CurrencyCommand.php @@ -7,11 +7,15 @@ use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface; use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyCreateStruct; use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyUpdateStruct; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:currency' +)] final class CurrencyCommand extends Command { private CurrencyServiceInterface $currencyService; @@ -23,11 +27,10 @@ final class CurrencyCommand extends Command public function __construct(CurrencyServiceInterface $currencyService, UserService $userService, PermissionResolver $permissionResolver) { $this->currencyService = $currencyService; - $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:currency'); + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php b/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php index d92d2df28b..7d67874e29 100644 --- a/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php @@ -8,11 +8,15 @@ use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\ProductCatalog\AssetServiceInterface; use Ibexa\Contracts\ProductCatalog\ProductServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:assets' +)] final class ProductAssetCommand extends Command { private UserService $userService; @@ -33,7 +37,8 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->productService = $productService; $this->assetService = $assetService; - parent::__construct('doc:assets'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/ProductCommand.php b/code_samples/api/product_catalog/src/Command/ProductCommand.php index 530fabcd51..d58a537f89 100644 --- a/code_samples/api/product_catalog/src/Command/ProductCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductCommand.php @@ -13,11 +13,15 @@ use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:product' +)] final class ProductCommand extends Command { private UserService $userService; @@ -46,7 +50,8 @@ public function __construct( $this->productTypeService = $productTypeService; $this->localProductService = $localProductService; $this->productAvailabilityService = $productAvailabilityService; - parent::__construct('doc:product'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php b/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php index 39feeb0c72..ce874bfe77 100644 --- a/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php @@ -16,11 +16,15 @@ use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalOr; use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product; use Money; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:price' +)] final class ProductPriceCommand extends Command { private ProductPriceServiceInterface $productPriceService; @@ -50,7 +54,7 @@ public function __construct( $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:price'); + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php b/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php index 70216e99fe..71af92cf14 100644 --- a/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:product_type' +)] final class ProductTypeCommand extends Command { private UserService $userService; @@ -23,7 +27,8 @@ public function __construct(UserService $userService, PermissionResolver $permis $this->userService = $userService; $this->permissionResolver = $permissionResolver; $this->productTypeService = $productTypeService; - parent::__construct('doc:product_type'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php b/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php index 1cd9f971a1..6d7bcf789a 100644 --- a/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php @@ -10,11 +10,15 @@ use Ibexa\Contracts\ProductCatalog\Local\Values\Product\ProductVariantCreateStruct; use Ibexa\Contracts\ProductCatalog\ProductServiceInterface; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductVariantQuery; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:product_variant' +)] final class ProductVariantCommand extends Command { private UserService $userService; @@ -35,7 +39,8 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->productService = $productService; $this->localProductService = $localProductService; - parent::__construct('doc:product_variant'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/product_catalog/src/Command/VatCommand.php b/code_samples/api/product_catalog/src/Command/VatCommand.php index 4f6b0395a6..8cd7bd265b 100644 --- a/code_samples/api/product_catalog/src/Command/VatCommand.php +++ b/code_samples/api/product_catalog/src/Command/VatCommand.php @@ -6,11 +6,15 @@ use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\ProductCatalog\RegionServiceInterface; use Ibexa\Contracts\ProductCatalog\VatServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:vat' +)] final class VatCommand extends Command { private UserService $userService; @@ -31,7 +35,8 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->vatService = $vatService; $this->regionService = $regionService; - parent::__construct('doc:vat'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php b/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php index d0f2d17d39..3025e68e4f 100644 --- a/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php +++ b/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php @@ -5,10 +5,14 @@ use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:add_language' +)] class AddLanguageCommand extends Command { private LanguageService $languageService; @@ -22,7 +26,8 @@ public function __construct(LanguageService $languageService, UserService $userS $this->languageService = $languageService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:add_language'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php b/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php index 4eea91fbc9..6d7d99c498 100644 --- a/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php @@ -6,11 +6,15 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:add_location' +)] class AddLocationToContentCommand extends Command { private ContentService $contentService; @@ -27,7 +31,8 @@ public function __construct(ContentService $contentService, LocationService $loc $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:add_location'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/BookmarkCommand.php b/code_samples/api/public_php_api/src/Command/BookmarkCommand.php index 8d40d1a100..072185599a 100644 --- a/code_samples/api/public_php_api/src/Command/BookmarkCommand.php +++ b/code_samples/api/public_php_api/src/Command/BookmarkCommand.php @@ -4,12 +4,16 @@ use Ibexa\Contracts\Core\Repository\BookmarkService; use Ibexa\Contracts\Core\Repository\LocationService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:bookmark' +)] class BookmarkCommand extends Command { private BookmarkService $bookmarkService; @@ -20,7 +24,8 @@ public function __construct(BookmarkService $bookmarkService, LocationService $l { $this->bookmarkService = $bookmarkService; $this->locationService = $locationService; - parent::__construct('doc:bookmark'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php b/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php index ee056f33e4..b3a39049a3 100644 --- a/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php +++ b/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php @@ -4,11 +4,15 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:browse_locations' +)] class BrowseLocationsCommand extends Command { private LocationService $locationService; @@ -16,7 +20,8 @@ class BrowseLocationsCommand extends Command public function __construct(LocationService $locationService) { $this->locationService = $locationService; - parent::__construct('doc:browse_locations'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/CalendarCommand.php b/code_samples/api/public_php_api/src/Command/CalendarCommand.php index 47d770dbd6..ea46cf7088 100644 --- a/code_samples/api/public_php_api/src/Command/CalendarCommand.php +++ b/code_samples/api/public_php_api/src/Command/CalendarCommand.php @@ -7,10 +7,14 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Scheduler\Calendar\EventAction\RescheduleEventActionContext; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:calendar' +)] class CalendarCommand extends Command { private PermissionResolver $permissionResolver; @@ -24,7 +28,8 @@ public function __construct(PermissionResolver $permissionResolver, UserService $this->permissionResolver = $permissionResolver; $this->userService = $userService; $this->calendarService = $calendarService; - parent::__construct('doc:calendar'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/CreateContentCommand.php b/code_samples/api/public_php_api/src/Command/CreateContentCommand.php index 9cf37efb41..be1ca6db5a 100644 --- a/code_samples/api/public_php_api/src/Command/CreateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateContentCommand.php @@ -7,12 +7,16 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:create_content' +)] class CreateContentCommand extends Command { private ContentService $contentService; @@ -32,7 +36,8 @@ public function __construct(ContentService $contentService, ContentTypeService $ $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:create_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php b/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php index de30893c8a..d65feed9f4 100644 --- a/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php @@ -6,12 +6,16 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:create_content_type' +)] class CreateContentTypeCommand extends Command { private ContentTypeService $contentTypeService; @@ -25,7 +29,8 @@ public function __construct(ContentTypeService $contentTypeService, UserService $this->contentTypeService = $contentTypeService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:create_content_type'); + + parent::__construct(); } protected function configure(): void @@ -38,7 +43,7 @@ protected function configure(): void ->addOption('copy', 'c', InputOption::VALUE_NONE, 'Do you want to make a copy of the content type?'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/CreateImageCommand.php b/code_samples/api/public_php_api/src/Command/CreateImageCommand.php index 67549c05ff..5aae67c0ef 100644 --- a/code_samples/api/public_php_api/src/Command/CreateImageCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateImageCommand.php @@ -8,12 +8,16 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Core\FieldType\Image\Value; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:create_image' +)] class CreateImageCommand extends Command { private ContentService $contentService; @@ -33,7 +37,8 @@ public function __construct(ContentService $contentService, ContentTypeService $ $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:create_image'); + + parent::__construct(); } protected function configure(): void @@ -46,7 +51,7 @@ protected function configure(): void ->addOption('publish', 'p', InputOption::VALUE_NONE, 'Do you want to publish the content item?'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php b/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php index 0d093ec56b..7aa74ffd89 100644 --- a/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:delete_content' +)] class DeleteContentCommand extends Command { private LocationService $locationService; @@ -23,7 +27,8 @@ public function __construct(LocationService $locationService, UserService $userS $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:delete_content'); + + parent::__construct(); } protected function configure(): void @@ -33,7 +38,7 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/FilterCommand.php b/code_samples/api/public_php_api/src/Command/FilterCommand.php index 1afd7294e4..c4f6b26515 100644 --- a/code_samples/api/public_php_api/src/Command/FilterCommand.php +++ b/code_samples/api/public_php_api/src/Command/FilterCommand.php @@ -7,11 +7,15 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:filter' +)] class FilterCommand extends Command { private ContentService $contentService; @@ -19,7 +23,8 @@ class FilterCommand extends Command public function __construct(ContentService $contentService) { $this->contentService = $contentService; - parent::__construct('doc:filter'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php b/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php index dc17b915e3..e7f68046fa 100644 --- a/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php @@ -7,11 +7,15 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:filter_location' +)] class FilterLocationCommand extends Command { private LocationService $locationService; @@ -19,7 +23,8 @@ class FilterLocationCommand extends Command public function __construct(LocationService $locationService) { $this->locationService = $locationService; - parent::__construct('doc:filter_location'); + + parent::__construct(); } public function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/FindComplexCommand.php b/code_samples/api/public_php_api/src/Command/FindComplexCommand.php index da00ad2413..fdf2d72cb1 100644 --- a/code_samples/api/public_php_api/src/Command/FindComplexCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindComplexCommand.php @@ -7,11 +7,15 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:find_complex' +)] class FindComplexCommand extends Command { private SearchService $searchService; @@ -22,7 +26,8 @@ public function __construct(SearchService $searchService, LocationService $locat { $this->searchService = $searchService; $this->locationService = $locationService; - parent::__construct('doc:find_complex'); + + parent::__construct(); } protected function configure(): void @@ -36,7 +41,7 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $locationId = (int) $input->getArgument('locationId'); $contentTypeIdentifier = $input->getArgument('contentTypeIdentifier'); diff --git a/code_samples/api/public_php_api/src/Command/FindContentCommand.php b/code_samples/api/public_php_api/src/Command/FindContentCommand.php index 04f36dcf26..881a10d87a 100644 --- a/code_samples/api/public_php_api/src/Command/FindContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:find_content' +)] class FindContentCommand extends Command { private SearchService $searchService; @@ -17,7 +21,8 @@ class FindContentCommand extends Command public function __construct(SearchService $searchService) { $this->searchService = $searchService; - parent::__construct('doc:find_content'); + + parent::__construct(); } protected function configure(): void @@ -29,7 +34,7 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $contentTypeIdentifier = $input->getArgument('contentTypeIdentifier'); diff --git a/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php b/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php index 7da4ec8e60..0910cf7a01 100644 --- a/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php @@ -4,11 +4,15 @@ use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:find_in_trash' +)] class FindInTrashCommand extends Command { private TrashService $trashService; @@ -16,7 +20,8 @@ class FindInTrashCommand extends Command public function __construct(TrashService $trashService) { $this->trashService = $trashService; - parent::__construct('doc:find_in_trash'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/FindUrlCommand.php b/code_samples/api/public_php_api/src/Command/FindUrlCommand.php index 4ec7d4bb22..c5b1b13aa7 100644 --- a/code_samples/api/public_php_api/src/Command/FindUrlCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindUrlCommand.php @@ -8,10 +8,14 @@ use Ibexa\Contracts\Core\Repository\Values\URL\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\URL\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:find_url' +)] class FindUrlCommand extends Command { private URLService $urlService; @@ -25,7 +29,8 @@ public function __construct(URLService $URLService, UserService $userService, Pe $this->urlService = $URLService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:find_url'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php b/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php index a59526b86b..b8de4edf94 100644 --- a/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php @@ -7,10 +7,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\ContentTypeTermAggregation; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\Field\SelectionTermAggregation; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:find_with_aggregation' +)] class FindWithAggregationCommand extends Command { private SearchService $searchService; @@ -18,7 +22,8 @@ class FindWithAggregationCommand extends Command public function __construct(SearchService $searchService) { $this->searchService = $searchService; - parent::__construct('doc:find_with_aggregation'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php b/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php index b7a28e5716..2f05b2c9b9 100644 --- a/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php +++ b/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php @@ -6,10 +6,14 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\FormBuilder\FormSubmission\FormSubmissionServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:form-submission' +)] final class FormSubmissionCommand extends Command { private UserService $userService; @@ -27,7 +31,7 @@ public function __construct(UserService $userService, PermissionResolver $permis $this->formSubmissionService = $formSubmissionService; $this->contentService = $contentService; - parent::__construct('doc:form-submission'); + parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/code_samples/api/public_php_api/src/Command/HideLocationCommand.php b/code_samples/api/public_php_api/src/Command/HideLocationCommand.php index bbde77ed49..86ba8dc96a 100644 --- a/code_samples/api/public_php_api/src/Command/HideLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/HideLocationCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:hide' +)] class HideLocationCommand extends Command { private LocationService $locationService; @@ -23,7 +27,8 @@ public function __construct(LocationService $locationService, UserService $userS $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:hide'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/MoveContentCommand.php b/code_samples/api/public_php_api/src/Command/MoveContentCommand.php index fc85c9d551..12b9f3e95f 100644 --- a/code_samples/api/public_php_api/src/Command/MoveContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/MoveContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:move_content' +)] class MoveContentCommand extends Command { private LocationService $locationService; @@ -23,7 +27,8 @@ public function __construct(LocationService $locationService, UserService $userS $this->locationService = $locationService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:move_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php b/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php index 2f648bd716..7f2c3c6b8d 100644 --- a/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php +++ b/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php @@ -6,11 +6,15 @@ use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:object_state' +)] class ObjectStateCommand extends Command { private ContentService $contentService; @@ -27,7 +31,8 @@ public function __construct(ContentService $contentService, UserService $userSer $this->userService = $userService; $this->objectStateService = $objectStateService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:object_state'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/SectionCommand.php b/code_samples/api/public_php_api/src/Command/SectionCommand.php index 2c3041afc8..1f06cf1152 100644 --- a/code_samples/api/public_php_api/src/Command/SectionCommand.php +++ b/code_samples/api/public_php_api/src/Command/SectionCommand.php @@ -9,11 +9,15 @@ use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:section' +)] class SectionCommand extends Command { private SectionService $sectionService; @@ -33,7 +37,8 @@ public function __construct(SectionService $sectionService, UserService $userSer $this->permissionResolver = $permissionResolver; $this->searchService = $searchService; $this->contentService = $contentService; - parent::__construct('doc:section'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/SegmentCommand.php b/code_samples/api/public_php_api/src/Command/SegmentCommand.php index 88cc31c1b2..a1e8760657 100644 --- a/code_samples/api/public_php_api/src/Command/SegmentCommand.php +++ b/code_samples/api/public_php_api/src/Command/SegmentCommand.php @@ -7,10 +7,14 @@ use Ibexa\Segmentation\Service\SegmentationService; use Ibexa\Segmentation\Value\SegmentCreateStruct; use Ibexa\Segmentation\Value\SegmentGroupCreateStruct; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:segment' +)] class SegmentCommand extends Command { private SegmentationService $segmentationService; @@ -24,7 +28,8 @@ public function __construct(SegmentationService $segmentationService, UserServic $this->segmentationService = $segmentationService; $this->permissionResolver = $permissionResolver; $this->userService = $userService; - parent::__construct('doc:segment'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php b/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php index 595cf00430..1d75a60d5d 100644 --- a/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:set_main_location' +)] class SetMainLocationCommand extends Command { private ContentService $contentService; @@ -23,7 +27,8 @@ public function __construct(ContentService $contentService, UserService $userSer $this->contentService = $contentService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:set_main_location'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php b/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php index aca0e22808..de0b0bb3b9 100644 --- a/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php +++ b/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php @@ -7,10 +7,14 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:taxonomy' +)] class TaxonomyCommand extends Command { private TaxonomyServiceInterface $taxonomyService; @@ -27,14 +31,11 @@ public function __construct( $this->taxonomyService = $taxonomyService; $this->permissionResolver = $permissionResolver; $this->userService = $userService; - parent::__construct('doc:taxonomy'); - } - public function configure(): void - { + parent::__construct(); } - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php b/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php index 83fbf3883f..0e33007661 100644 --- a/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:translate_content' +)] class TranslateContentCommand extends Command { private ContentService $contentService; @@ -23,7 +27,8 @@ public function __construct(ContentService $contentService, UserService $userSer $this->contentService = $contentService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:translate_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/TrashContentCommand.php b/code_samples/api/public_php_api/src/Command/TrashContentCommand.php index f23d8256c2..88a799273b 100644 --- a/code_samples/api/public_php_api/src/Command/TrashContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/TrashContentCommand.php @@ -6,12 +6,16 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:trash_content' +)] class TrashContentCommand extends Command { private LocationService $locationService; @@ -28,7 +32,8 @@ public function __construct(LocationService $locationService, UserService $userS $this->userService = $userService; $this->trashService = $trashService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:trash_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php b/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php index 570f525716..4bd45f5569 100644 --- a/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:update_content' +)] class UpdateContentCommand extends Command { private ContentService $contentService; @@ -23,7 +27,8 @@ public function __construct(ContentService $contentService, UserService $userSer $this->contentService = $contentService; $this->userService = $userService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:update_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/ViewContentCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentCommand.php index e5c22f74fd..02ca0536e3 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\FieldTypeService; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:view_content' +)] class ViewContentCommand extends Command { private ContentService $contentService; @@ -23,7 +27,8 @@ public function __construct(ContentService $contentService, ContentTypeService $ $this->contentService = $contentService; $this->contentTypeService = $contentTypeService; $this->fieldTypeService = $fieldTypeService; - parent::__construct('doc:view_content'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 6037ae2515..35d37c56b8 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -9,11 +9,15 @@ use Ibexa\Contracts\Core\Repository\URLAliasService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:view_metadata' +)] class ViewContentMetaDataCommand extends Command { private ContentService $contentService; @@ -36,7 +40,8 @@ public function __construct(ContentService $contentService, LocationService $loc $this->userService = $userService; $this->objectStateService = $objectStateService; $this->permissionResolver = $permissionResolver; - parent::__construct('doc:view_metadata'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/api/public_php_api/src/Command/WorkflowCommand.php b/code_samples/api/public_php_api/src/Command/WorkflowCommand.php index f36d877a77..60cf29d89a 100644 --- a/code_samples/api/public_php_api/src/Command/WorkflowCommand.php +++ b/code_samples/api/public_php_api/src/Command/WorkflowCommand.php @@ -5,11 +5,15 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Workflow\Registry\WorkflowRegistryInterface; use Ibexa\Contracts\Workflow\Service\WorkflowServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:workflow' +)] class WorkflowCommand extends Command { private WorkflowServiceInterface $workflowService; @@ -23,7 +27,8 @@ public function __construct(WorkflowServiceInterface $workflowService, WorkflowR $this->contentService = $contentService; $this->workflowService = $workflowService; $this->workflowRegistry = $workflowRegistry; - parent::__construct('doc:workflow'); + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/back_office/dashboard/src/Command/DashboardCommand.php b/code_samples/back_office/dashboard/src/Command/DashboardCommand.php index 9775971426..512441effc 100644 --- a/code_samples/back_office/dashboard/src/Command/DashboardCommand.php +++ b/code_samples/back_office/dashboard/src/Command/DashboardCommand.php @@ -8,15 +8,17 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Dashboard\DashboardServiceInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand( + name: 'doc:dashboard' +)] class DashboardCommand extends Command { - protected static $defaultName = 'doc:dashboard'; - private DashboardServiceInterface $dashboardService; private Locationservice $locationService; @@ -37,7 +39,7 @@ public function __construct( $this->userService = $repository->getUserService(); $this->permissionResolver = $repository->getPermissionResolver(); - parent::__construct(self::$defaultName); + parent::__construct(); } public function configure(): void diff --git a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php index af57c761f2..86d37860e9 100644 --- a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php +++ b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php @@ -3,19 +3,20 @@ namespace App\Search\Serializer\Normalizer\Suggestion; use App\Search\Model\Suggestion\ProductSuggestion; -use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class ProductSuggestionNormalizer implements NormalizerInterface, - NormalizerAwareInterface, - CacheableSupportsMethodInterface + NormalizerAwareInterface { use NormalizerAwareTrait; - public function normalize($object, string $format = null, array $context = []) + /** + * @return array + */ + public function normalize($object, string $format = null, array $context = []): array { /** @var \App\Search\Model\Suggestion\ProductSuggestion $object */ return [ @@ -27,13 +28,15 @@ public function normalize($object, string $format = null, array $context = []) ]; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return $data instanceof ProductSuggestion; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format): array { - return true; + return [ + ProductSuggestion::class => true, + ]; } } diff --git a/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php b/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php index da68931e11..a184db52d9 100644 --- a/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php +++ b/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php @@ -25,7 +25,7 @@ protected function createCriterion(array $data, string $type, ?string $format, a return new Criterion\SectionIdentifier($data['value']); } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return $data instanceof Criterion\SectionIdentifier; } diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php index 38b6526fde..96b2b84497 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php @@ -8,7 +8,7 @@ final class ValueDenormalizer implements DenormalizerInterface { - public function denormalize($data, string $class, string $format = null, array $context = []) + public function denormalize($data, string $class, string $format = null, array $context = []): mixed { if (isset($data['x']) && isset($data['y'])) { // Support for old format @@ -18,8 +18,15 @@ public function denormalize($data, string $class, string $format = null, array $ return new $class($data); } - public function supportsDenormalization($data, string $type, string $format = null) + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return $type === Value::class; } + + public function getSupportedTypes(?string $format): array + { + return [ + Value::class => true, + ]; + } } diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php index 4cf70fa9d3..c21c39b211 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php @@ -8,7 +8,10 @@ final class ValueNormalizer implements NormalizerInterface { - public function normalize($object, string $format = null, array $context = []) + /** + * @return array + */ + public function normalize($object, string $format = null, array $context = []): array { return [ $object->getX(), @@ -16,8 +19,15 @@ public function normalize($object, string $format = null, array $context = []) ]; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Value; } + + public function getSupportedTypes(?string $format): array + { + return [ + Value::class => true, + ]; + } } diff --git a/code_samples/front/render_content_in_php/src/Command/ViewCommand.php b/code_samples/front/render_content_in_php/src/Command/ViewCommand.php index 37ab0392e7..7c8222d0d0 100644 --- a/code_samples/front/render_content_in_php/src/Command/ViewCommand.php +++ b/code_samples/front/render_content_in_php/src/Command/ViewCommand.php @@ -4,15 +4,17 @@ use Ibexa\Core\MVC\Symfony\View\Builder\ContentViewBuilder; use Ibexa\Core\MVC\Symfony\View\Renderer\TemplateRenderer; +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; +#[AsCommand( + name: 'app:view' +)] class ViewCommand extends Command { - protected static $defaultName = 'app:view'; - private ContentViewBuilder $contentViewBuilder; private TemplateRenderer $templateRenderer; @@ -21,9 +23,10 @@ public function __construct( ContentViewBuilder $contentViewBuilder, TemplateRenderer $templateRenderer ) { - parent::__construct(self::$defaultName); $this->contentViewBuilder = $contentViewBuilder; $this->templateRenderer = $templateRenderer; + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php b/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php index 342b268c8c..d4c93ccd5f 100644 --- a/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php +++ b/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php @@ -10,18 +10,19 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +#[AsCommand( + name: 'doc:test:activity-log-context', + description: 'Test activity log context usage' +)] class ActivityLogContextTestCommand extends Command { - protected static $defaultName = 'doc:test:activity-log-context'; - - protected static $defaultDescription = 'Test activity log context usage'; - private ActivityLogServiceInterface $activityLogService; private ContentService $contentService; @@ -42,13 +43,14 @@ public function __construct( PermissionResolver $permissionResolver, UserService $userService ) { - parent::__construct(self::$defaultName); $this->activityLogService = $activityLogService; $this->contentService = $contentService; $this->contentTypeService = $contentTypeService; $this->eventDispatcher = $eventDispatcher; $this->permissionResolver = $permissionResolver; $this->userService = $userService; + + parent::__construct(); } protected function configure(): void diff --git a/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php b/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php index 070c4a7753..2b6e1baafa 100644 --- a/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php +++ b/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php @@ -4,22 +4,24 @@ use App\Event\MyFeatureEvent; use App\MyFeature\MyFeature; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +#[AsCommand( + name: 'app:test:throw-my-feature-event', + description: 'Throw/Dispatch a MyFeatureEvent' +)] class DispatchMyFeatureEventCommand extends Command { - protected static $defaultName = 'app:test:throw-my-feature-event'; - - protected static $defaultDescription = 'Throw/Dispatch a MyFeatureEvent'; - private EventDispatcherInterface $eventDispatcher; public function __construct(EventDispatcherInterface $eventDispatcher) { $this->eventDispatcher = $eventDispatcher; + parent::__construct(); } diff --git a/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php b/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php index 81c62b7d05..52808377f9 100644 --- a/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php +++ b/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php @@ -9,17 +9,18 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand( + name: 'app:monitor-content-creation', + description: 'List last 10 log entry groups with creations in the last hour' +)] class MonitorRecentContentCreationCommand extends Command { - protected static $defaultName = 'app:monitor-content-creation'; - - protected static $defaultDescription = 'List last 10 log entry groups with creations in the last hour'; - private ActivityLogServiceInterface $activityLogService; private PermissionResolver $permissionResolver; @@ -31,6 +32,7 @@ public function __construct(ActivityLogServiceInterface $activityLogService, Per $this->permissionResolver = $permissionResolver; $this->userService = $userService; $this->activityLogService = $activityLogService; + parent::__construct(); } diff --git a/composer.json b/composer.json index edad1fd446..be16475735 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,8 @@ "ibexa/version-comparison": "5.0.x-dev", "league/oauth2-google": "^4.0", "ibexa/core-search": "~5.0.x-dev", - "ibexa/connector-dam": "~5.0.x-dev" + "ibexa/connector-dam": "~5.0.x-dev", + "ibexa/twig-components": "~5.0.x-dev" }, "scripts": { "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", diff --git a/docs/administration/dashboard/php_api_dashboard_service.md b/docs/administration/dashboard/php_api_dashboard_service.md index 02b06ee025..9ecff035fb 100644 --- a/docs/administration/dashboard/php_api_dashboard_service.md +++ b/docs/administration/dashboard/php_api_dashboard_service.md @@ -24,7 +24,7 @@ Using the `admin` account, it loads the group members, logs each one in, creates First argument is the `Content ID` of the dashboard to copy. Following arguments are the Content IDs of the user groups. -``` php hl_lines="61" +``` php hl_lines="63" [[= include_file('code_samples/back_office/dashboard/src/Command/DashboardCommand.php') =]] ``` @@ -32,4 +32,4 @@ The following line runs the command with `74` as the model dashboard's Content I ```bash php bin/console doc:dashboard 74 13 --siteaccess=admin -``` \ No newline at end of file +``` diff --git a/docs/administration/recent_activity/recent_activity.md b/docs/administration/recent_activity/recent_activity.md index 02e3dcd0e5..cc7a5d8287 100644 --- a/docs/administration/recent_activity/recent_activity.md +++ b/docs/administration/recent_activity/recent_activity.md @@ -190,7 +190,7 @@ In the following example, several actions are logged into one context group, eve - `complete` ``` php -[[= include_file('code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php', 63, 83) =]] +[[= include_file('code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php', 62, 82) =]] ``` Context groups can't be nested. diff --git a/docs/ai_actions/extend_ai_actions.md b/docs/ai_actions/extend_ai_actions.md index d1ecfe397c..bc68ea840e 100644 --- a/docs/ai_actions/extend_ai_actions.md +++ b/docs/ai_actions/extend_ai_actions.md @@ -15,7 +15,7 @@ For example, you can create a handler that connects to a translation model and u You can execute AI Actions by using the [ActionServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example: ``` php -[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 102, 121) =]] +[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 105, 124) =]] ``` The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response. @@ -44,7 +44,7 @@ You can influence the execution of an Action with two events: Below you can find the full example of a Symfony Command, together with a matching service definition. The command finds the images modified in the last 24 hours, and adds the alternative text to them if it's missing. -``` php hl_lines="88 101-126" +``` php hl_lines="91 104-129" [[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php') =]] ``` @@ -78,7 +78,7 @@ See [Action Configuration Search Criteria reference](action_configuration_criter The following example creates a new Action Configuration: ``` php hl_lines="3 17" -[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 59, 76) =]] +[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 62, 79) =]] ``` Actions Configurations are tied to a specific Action Type and are translatable. @@ -89,7 +89,7 @@ Reuse existing Action Configurations to simplify the execution of AI Actions. You can pass one directly to the `ActionServiceInterface::execute()` method: ``` php hl_lines="7-8" -[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 77, 85) =]] +[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 80, 88) =]] ``` The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method. diff --git a/docs/api/php_api/php_api.md b/docs/api/php_api/php_api.md index 2bf0aa4ad8..aa227ac40c 100644 --- a/docs/api/php_api/php_api.md +++ b/docs/api/php_api/php_api.md @@ -126,7 +126,7 @@ While [using `sudo()`](#using-sudo) is the recommended option, you can also set To identify as a different user, you need to use the `UserService` together with `PermissionResolver` (in the example `admin` is the login of the administrator user): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 50, 52) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 55, 57) =]] ``` !!! tip diff --git a/docs/commerce/order_management/order_management_api.md b/docs/commerce/order_management/order_management_api.md index 57e2ff2dff..fbacc731af 100644 --- a/docs/commerce/order_management/order_management_api.md +++ b/docs/commerce/order_management/order_management_api.md @@ -18,7 +18,7 @@ To get orders and manage them, use the `Ibexa\Contracts\OrderManagement\OrderSer To access a single order by using its string identifier, use the `OrderService::getOrderByIdentifier` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 57, 61) =]] +[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 61, 65) =]] ``` ### Get single order by ID @@ -26,7 +26,7 @@ To access a single order by using its string identifier, use the `OrderService:: To access a single order by using its numerical ID, use the `OrderService::getOrder` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 63, 67) =]] +[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 67, 72) =]] ``` ## Get multiple orders @@ -38,7 +38,7 @@ It follows the same search query pattern as other APIs: [[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 8, 9) =]][[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 10, 14) =]] // ... -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 116, 125) =]] +[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 120, 130) =]] ``` ## Create order @@ -46,7 +46,7 @@ It follows the same search query pattern as other APIs: To create an order, use the `OrderService::createOrder` method and provide it with the `Ibexa\Contracts\OrderManagement\Value\OrderCreateStruct` object that contains a list of products, purchased quantities, product, total prices, and tax amounts. ``` php -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 97, 108) =]] +[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 101, 113) =]] ``` ## Update order @@ -56,5 +56,5 @@ You could do it to support a scenario when, for example, the order is processed To update order information, use the `OrderService::updateOrder` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 110, 114) =]] +[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 114, 119) =]] ``` diff --git a/docs/commerce/payment/extend_payment.md b/docs/commerce/payment/extend_payment.md index 1e06aa845f..feb410f7a7 100644 --- a/docs/commerce/payment/extend_payment.md +++ b/docs/commerce/payment/extend_payment.md @@ -94,11 +94,11 @@ When you create a payment, you can attach custom data to it, for example, you ca You add custom data by using the `setContext` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 89, 101) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 97, 109) =]] ``` Then, you retrieve it with the `getContext` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 66, 69) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 70, 74) =]] ``` diff --git a/docs/commerce/payment/payment_api.md b/docs/commerce/payment/payment_api.md index 4c5c90c414..93d416df7f 100644 --- a/docs/commerce/payment/payment_api.md +++ b/docs/commerce/payment/payment_api.md @@ -17,7 +17,7 @@ You can change that by providing a custom payment identifier in `Ibexa\Contracts To access a single payment by using its numerical ID, use the `PaymentServiceInterface::getPayment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 60, 64) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 64, 68) =]] ``` ### Get single payment by identifier @@ -25,7 +25,7 @@ To access a single payment by using its numerical ID, use the `PaymentServiceInt To access a single payment by using its string identifier, use the `PaymentServiceInterface::getPaymentByIdentifier` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 66, 70) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 70, 72) =]] ``` ## Get multiple payments @@ -34,7 +34,7 @@ To fetch multiple payments, use the `PaymentServiceInterface::findPayments` meth It follows the same search query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 72, 88) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 79, 95) =]] ``` ## Create payment @@ -42,8 +42,8 @@ It follows the same search query pattern as other APIs: To create a payment, use the `PaymentServiceInterface::createPayment` method and provide it with the `Ibexa\Contracts\Payment\Payment\PaymentCreateStruct` object that takes the following arguments: `method`, `order` and `amount`. ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 94, 94) =]] -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 101, 104) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 101, 105) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 108, 112) =]] ``` ## Update payment @@ -54,7 +54,7 @@ The `Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct` object takes the follo To update payment information, use the `PaymentServiceInterface::updatePayment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 106, 112) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 113, 119) =]] ``` ## Delete payment @@ -62,5 +62,5 @@ To update payment information, use the `PaymentServiceInterface::updatePayment` To delete a payment from the system, use the `PaymentServiceInterface::deletePayment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 114, 115) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 121, 122) =]] ``` diff --git a/docs/commerce/payment/payment_method_api.md b/docs/commerce/payment/payment_method_api.md index 1edd74c98e..d65c18ac71 100644 --- a/docs/commerce/payment/payment_method_api.md +++ b/docs/commerce/payment/payment_method_api.md @@ -26,7 +26,7 @@ From the developer's perspective, payment methods are referenced with identifier To access a single payment method by using its string identifier, use the `PaymentMethodService::getPaymentMethodByIdentifier` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 52, 56) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 56, 60) =]] ``` ### Get single payment method by ID @@ -34,7 +34,7 @@ To access a single payment method by using its string identifier, use the `Payme To access a single payment method by using its numerical ID, use the `PaymentMethodService::getPaymentMethod` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 46, 50) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 50, 54) =]] ``` ## Get multiple payment methods @@ -44,7 +44,7 @@ To fetch multiple payment methods, use the `PaymentMethodService::findPaymentMet It follows the same search query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 58, 75) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 62, 79) =]] ``` ## Create payment method @@ -59,7 +59,7 @@ To create a payment method, use the `PaymentMethodService::createPaymentMethod` - `options` object. ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 58, 59) =]][[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 77, 87) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 62, 63) =]][[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 81, 91) =]] ``` ## Update payment method @@ -70,14 +70,14 @@ An `Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodUpdateStruct` object can To update payment method information, use the `PaymentMethodServiceInterface::updatePaymentMethod` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 89, 99) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 93, 103) =]] ``` ## Delete payment method To delete a payment method from the system, use the `PaymentMethodService::deletePayment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 101, 107) =]] +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 105, 111) =]] ``` ## Check whether payment method is used @@ -85,5 +85,5 @@ To delete a payment method from the system, use the `PaymentMethodService::delet To check whether a payment method is used, for example, before you delete it, use the `PaymentMethodService::isPaymentMethodUsed` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 109, 122) =]] -``` \ No newline at end of file +[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 113, 126) =]] +``` diff --git a/docs/commerce/shipping_management/shipment_api.md b/docs/commerce/shipping_management/shipment_api.md index 961826a2d8..3d6140a151 100644 --- a/docs/commerce/shipping_management/shipment_api.md +++ b/docs/commerce/shipping_management/shipment_api.md @@ -16,7 +16,7 @@ From the developer's perspective, shipments are referenced with a UUID identifie To access a single shipment by using its string identifier, use the `ShipmentService::getShipmentByIdentifier` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 69, 78) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 73, 82) =]] ``` ### Get single shipment by id @@ -24,7 +24,7 @@ To access a single shipment by using its string identifier, use the `ShipmentSer To access a single shipment by using its numerical id, use the `ShipmentService::getShipment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 57, 67) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 61, 71) =]] ``` ## Get multiple shipments @@ -33,7 +33,7 @@ To fetch multiple shipments, use the `ShipmentService::findShipments` method. It follows the same search query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 80, 99) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 84, 103) =]] ``` ## Create shipment @@ -41,7 +41,7 @@ It follows the same search query pattern as other APIs: To create a shipment, use the `ShipmentService::createShipment` method and provide it with an `Ibexa\Contracts\Shipping\Value\ShipmentCreateStruct` object that takes two parameters, a `shippingMethod` string and a `Money` object. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 101, 115) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 105, 119) =]] ``` ## Update shipment @@ -51,7 +51,7 @@ You could do it to support a scenario when, for example, the shipment is process To update shipment information, use the `ShipmentService::updateShipment` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 117, 128) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 121, 132) =]] ``` ## Delete shipment @@ -59,5 +59,5 @@ To delete a shipment from the system, use the `ShipmentService::deleteShipment` ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 130, 131) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 134, 135) =]] ``` diff --git a/docs/commerce/shipping_management/shipping_method_api.md b/docs/commerce/shipping_management/shipping_method_api.md index b276ddcf84..a869cd3570 100644 --- a/docs/commerce/shipping_management/shipping_method_api.md +++ b/docs/commerce/shipping_management/shipping_method_api.md @@ -17,7 +17,7 @@ To access a shipping method by using its identifier, use the `ShippingMethodServ The method takes a string as `$identifier` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 61, 71) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 65, 75) =]] ``` ### Get shipping method by ID @@ -26,7 +26,7 @@ To access a shipping method by using its ID, use the `ShippingMethodServiceInter The method takes a string as `$id` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 49, 59) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 53, 63) =]] ``` ## Get multiple shipping methods @@ -35,7 +35,7 @@ To fetch multiple shipping methods, use the `ShippingMethodServiceInterface::get It follows the same search query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 73, 91) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 77, 95) =]] ``` ## Create shipping method @@ -43,7 +43,7 @@ It follows the same search query pattern as other APIs: To create a shipping method, use the `ShippingMethodServiceInterface::createShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodCreateStruct` object that you created by using the `newShippingMethodCreateStruct` method. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 92, 116) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 97, 120) =]] ``` ## Update shipping method @@ -51,7 +51,7 @@ To create a shipping method, use the `ShippingMethodServiceInterface::createShip To update a shipping method, use the `ShippingMethodServiceInterface::updateShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodUpdateStruct` object that you created by using the `newShippingMethodUpdateStruct` method. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 118, 133) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 122, 137) =]] ``` ## Delete shipping method @@ -59,7 +59,7 @@ To update a shipping method, use the `ShippingMethodServiceInterface::updateShip To update a shipping method, use the `ShippingMethodServiceInterface::deleteShippingMethod` method. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 134, 140) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 138, 144) =]] ``` ## Delete shipping method translation @@ -67,5 +67,5 @@ To update a shipping method, use the `ShippingMethodServiceInterface::deleteShip To delete shipping method translation, use the `ShippingMethodServiceInterface::deleteShippingMethodTranslation` method. ``` php -[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 142, 151) =]] +[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 146, 155) =]] ``` diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 719178a5e3..523d38328e 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -25,15 +25,15 @@ This value object provides primitive fields, such as `contentTypeId`, `published You can also use it to request other Content-related value objects from various services: -``` php hl_lines="9" +``` php hl_lines="10" // ... [[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 4, 5) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 16, 17) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 20, 22) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 50, 52) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 58, 59) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 60, 66) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 55, 57) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 63, 72) =]] ``` + `ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 9). It provides you with basic content metadata such as modification and publication dates or main language code. @@ -46,7 +46,7 @@ It provides you with basic content metadata such as modification and publication To get the locations of a content item you need to make use of the [`LocationService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 68, 72) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 73, 77) =]] } ``` [`LocationService::loadLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_loadLocations) uses `ContentInfo` to get all the locations of a content item. @@ -60,7 +60,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C [`URLAliasService::reverseLookup`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-URLAliasService.html#method_reverseLookup) gets the location's main [URL alias](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-URLAlias.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 68, 71) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 72, 75) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 73, 76) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 77, 80) =]] ``` ### Content type @@ -68,7 +68,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C You can retrieve the content type of a content item through the [`getContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 77, 79) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 82, 84) =]] ``` ### Versions @@ -76,13 +76,13 @@ You can retrieve the content type of a content item through the [`getContentType To iterate over the versions of a content item, use the [`ContentService::loadVersions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersions) method, which returns an array of `VersionInfo` value objects. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 81, 87) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 86, 92) =]] ``` You can additionally provide the `loadVersions` method with the version status to get only versions of a specific status, for example: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 88, 89) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 93, 94) =]] ``` !!! note @@ -98,7 +98,7 @@ This method loads only the specified subset of relations to improve performance You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 107) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 105, 112) =]] ``` You can also specify the version number as the second argument to get Relations for a specific version: @@ -117,7 +117,7 @@ It also holds the [relation type](content_relations.md), and the optional field You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 109, 110) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 115) =]] ``` To get the creator of the current version and not the content item's owner, you need to use the `creatorId` property from the current version's `VersionInfo` object. @@ -127,7 +127,7 @@ To get the creator of the current version and not the content item's owner, you You can find the section to which a content item belongs through the [`getSection`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getSection) method of the ContentInfo object: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 112, 113) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 117, 118) =]] ``` !!! note @@ -142,7 +142,7 @@ You need to provide it with the object state group. All object state groups can be retrieved through [`loadObjectStateGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 120) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 120, 125) =]] ``` ## Viewing content with fields @@ -151,7 +151,7 @@ To retrieve the fields of the selected content item, you can use the following c ```php hl_lines="13-14 16-22" [[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 4, 7) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 37, 55) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 42, 60) =]] } ``` @@ -182,7 +182,7 @@ $contentService->loadContent($content->id, Language::ALL); To go through all the content items contained in a subtree, you need to use the [`LocationService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html). ``` php hl_lines="5 15" -[[= include_file('code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php', 30, 49) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php', 35, 54) =]] ``` `loadLocation` (line 15) returns a value object, here a `Location`. diff --git a/docs/content_management/content_api/creating_content.md b/docs/content_management/content_api/creating_content.md index 1e9ff0d027..eb6723cef7 100644 --- a/docs/content_management/content_api/creating_content.md +++ b/docs/content_management/content_api/creating_content.md @@ -21,7 +21,7 @@ Value objects such as content items are read-only, so to create or modify them y returns a new [`ContentCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentCreateStruct.html) object. ``` php hl_lines="2-3 5" -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 57, 66) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 62, 71) =]] ``` This command creates a draft using [`ContentService::createContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_createContent) (line 7). @@ -42,7 +42,7 @@ Therefore, when creating a content item of the Image type (or any other content the `ContentCreateStruct` is slightly more complex than in the previous example: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateImageCommand.php', 56, 69) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateImageCommand.php', 61, 74) =]] ``` Value of the Image field type contains the path to the image file and other basic information based on the input file. @@ -66,7 +66,7 @@ To publish it, use [`ContentService::publishVersion`](/api/php_api/php_api_refer This method must get the [`VersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-VersionInfo.html) object of a draft version. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 68, 69) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 73, 74) =]] ``` ## Updating content @@ -76,7 +76,7 @@ and pass it to [`ContentService::updateContent`](/api/php_api/php_api_reference/ This method works on a draft, so to publish your changes you need to use [`ContentService::publishVersion`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_publishVersion) as well: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/UpdateContentCommand.php', 47, 55) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/UpdateContentCommand.php', 52, 60) =]] ``` ## Translating content @@ -86,15 +86,15 @@ Content [translations](languages.md#language-versions) are created per version. To translate a content item to a new language, you need to update it and provide a new `initialLanguageCode`: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 52, 57) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 62, 64) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 57, 62) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 67, 69) =]] ``` You can also update content in multiple languages at once using the `setField` method's third argument. Only one language can still be set as a version's initial language: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 59, 60) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 64, 65) =]] ``` ### Deleting a translation diff --git a/docs/content_management/content_api/managing_content.md b/docs/content_management/content_api/managing_content.md index 89cf5b4a93..e3a4dce915 100644 --- a/docs/content_management/content_api/managing_content.md +++ b/docs/content_management/content_api/managing_content.md @@ -22,8 +22,8 @@ Creating a new location, like creating content, requires using a struct, because To add a new location to existing content you need to create a [`LocationCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationCreateStruct.html) and pass it to the [`LocationService::createLocation`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_createLocation) method: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 50, 51) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 55, 57) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 55, 56) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 60, 62) =]] ``` `LocationCreateStruct` must receive the parent location ID. @@ -32,7 +32,7 @@ It sets the `parentLocationId` property of the new location. You can also provide other properties for the location, otherwise they're set to their defaults: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 52, 54) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 57, 59) =]] ``` ### Changing the main location @@ -41,7 +41,7 @@ When a content item has more that one location, one location is always considere You can change the main location using [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html), by updating the `ContentInfo` with a [`ContentUpdateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentUpdateStruct.html) that sets the new main location: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php', 48, 52) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php', 53, 57) =]] ``` ### Hiding and revealing locations @@ -49,7 +49,7 @@ You can change the main location using [`ContentService`](/api/php_api/php_api_r To hide or reveal (unhide) a location you need to make use of [`LocationService::hideLocation`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_hideLocation) or [`LocationService::unhideLocation`:](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_unhideLocation) ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 46, 47) =]][[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 49, 50) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 51, 52) =]][[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 54, 55) =]] ``` See [location visibility](locations.md#location-visibility) for detailed information on the behavior of visible and hidden Locations. @@ -66,14 +66,14 @@ Content which has more locations is still available in its other locations. If you delete the [main location](#changing-the-main-location) of a content item that has more locations, another location becomes the main one. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/DeleteContentCommand.php', 44, 45) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/DeleteContentCommand.php', 49, 50) =]] ``` To send the location and its subtree to Trash, use [`TrashService::trash`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#). Items in Trash can be later [restored, or deleted permanently](#trash). ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 54, 55) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 59, 60) =]] ``` ### Moving and copying a subtree @@ -81,7 +81,7 @@ Items in Trash can be later [restored, or deleted permanently](#trash). You can move a location with its whole subtree using [`LocationService::moveSubtree`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_moveSubtree): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/MoveContentCommand.php', 46, 49) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/MoveContentCommand.php', 51, 54) =]] ``` [`LocationService::copySubtree`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_copySubtree) is used in the same way, but it copies the location and its subtree instead of moving it. @@ -108,7 +108,7 @@ You must provide the method with the ID of the object in Trash. Trash location is identical to the origin location of the object. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 64, 65) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 69, 70) =]] ``` The content item is restored under its previous location. @@ -138,13 +138,13 @@ In this case you use [`ContentTypeCreateStruct`](/api/php_api/php_api_reference/ A content type must have at least one name, in the main language, and at least one field definition. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 59, 69) =]][[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 76, 85) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 64, 74) =]][[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 81, 90) =]] ``` You can specify more details of the field definition in the create struct, for example: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 67, 77) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 72, 82) =]] ``` ### Copying content types @@ -152,7 +152,7 @@ You can specify more details of the field definition in the create struct, for e To copy a content type, use [`ContentTypeService::copyContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentTypeService.html#method_copyContentType): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 89, 90) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 94, 95) =]] ``` The copy is automatically getting an identifier based on the original content type identifier and the copy's ID, for example: `copy_of_folder_21`. @@ -160,7 +160,7 @@ The copy is automatically getting an identifier based on the original content ty To change the identifier of the copy, use a [`ContentTypeUpdateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-ContentType-ContentTypeUpdateStruct.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 90, 96) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 95, 101) =]] ``` ## Calendar events @@ -177,19 +177,19 @@ To get a list of events for a specified time period, use the `CalendarServiceInt You need to provide the method with an EventQuery, which takes a date range and a count as the minimum of parameters: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 39, 50) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 44, 55) =]] ``` You can also get the first and last event in the list by using the `first()` and `last()` methods of an `EventCollection` (`Ibexa\Contracts\Calendar\EventCollection`): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 51, 53) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 56, 58) =]] ``` You can process the events in a collection using the `find(Closure $predicate)`, `filter(Closure $predicate)`, `map(Closure $callback)` or `slice(int $offset, ?int $length = null)` methods of `EventCollection`, for example: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 54, 57) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 59, 62) =]] ``` ### Performing calendar actions @@ -199,7 +199,7 @@ You must pass an `Ibexa\Contracts\Calendar\EventAction\EventActionContext` insta `EventActionContext` defines events on which the action is performed, and action-specific parameters, for example, a new date: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 59, 61) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 64, 66) =]] ``` ``` php diff --git a/docs/content_management/content_management_api/bookmark_api.md b/docs/content_management/content_management_api/bookmark_api.md index 95056a0661..9deab188b7 100644 --- a/docs/content_management/content_management_api/bookmark_api.md +++ b/docs/content_management/content_management_api/bookmark_api.md @@ -13,17 +13,17 @@ description: You can use the PHP API to view the bookmark list, and add or remov To view a list of all bookmarks, use [`BookmarkService::loadBookmarks`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_loadBookmarks): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 43, 50) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 48, 55) =]] ``` You can add a bookmark to a content item by providing its Location object to the [`BookmarkService::createBookmark`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_createBookmark) method: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 37, 40) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 42, 45) =]] ``` You can remove a bookmark from a location with [`BookmarkService::deleteBookmark`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_deleteBookmark): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 52, 53) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 57, 58) =]] ``` diff --git a/docs/content_management/data_migration/data_migration_api.md b/docs/content_management/data_migration/data_migration_api.md index e80225e725..53a17c8a6b 100644 --- a/docs/content_management/data_migration/data_migration_api.md +++ b/docs/content_management/data_migration/data_migration_api.md @@ -11,13 +11,13 @@ You can use the PHP API to manage and run [data migrations](data_migration.md). To list all migration files available in the directory defined in configuration (by default, `src/Migrations/Ibexa`), use the `MigrationService:listMigrations()` method: ``` php -[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 30, 33) =]] +[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 35, 38) =]] ``` To get a single migration file by its name, use the `MigrationService:findOneByName()` method: ``` php -[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 35, 36) =]] +[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 40, 41) =]] ``` ## Running migration files @@ -25,7 +25,7 @@ To get a single migration file by its name, use the `MigrationService:findOneByN To run migration file(s), use either `MigrationService:executeOne()` or `MigrationService:executeAll()`: ``` php -[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 37, 39) =]] +[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 42, 44) =]] ``` Both `executeOne()` and `executeAll()` can take an optional parameter: the login of the User that you want to execute the migrations as. @@ -35,5 +35,5 @@ Both `executeOne()` and `executeAll()` can take an optional parameter: the login To add a new migration file, use the `MigrationService:add()` method: ``` php -[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 23, 29) =]] +[[= include_file('code_samples/api/migration/src/Command/MigrationCommand.php', 28, 34) =]] ``` diff --git a/docs/content_management/workflow/workflow_api.md b/docs/content_management/workflow/workflow_api.md index d7b1770f9a..d6c46a6975 100644 --- a/docs/content_management/workflow/workflow_api.md +++ b/docs/content_management/workflow/workflow_api.md @@ -25,7 +25,7 @@ but the implementation in workflow service extends them, for example by providin To get information about a specific workflow for a content item, use `WorkflowServiceInterface::loadWorkflowMetadataForContent`: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 53, 57) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 58, 63) =]] ``` !!! tip @@ -36,7 +36,7 @@ To get information about a specific workflow for a content item, use `WorkflowSe To get a list of all workflows that can be used for a given content item, use `WorkflowRegistry`: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 47, 48) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 52, 53) =]] ``` ## Applying workflow transitions @@ -44,14 +44,14 @@ To get a list of all workflows that can be used for a given content item, use `W To place a content item in a workflow, use `WorkflowService::start`: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 52, 53) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 57, 58) =]] ``` To apply a transition to a content item, use `Workflow::apply`. Additionally, you can check if the transition is possible for the given object using `WorkflowService::can`: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 59, 62) =]] } +[[= include_file('code_samples/api/public_php_api/src/Command/WorkflowCommand.php', 64, 69) =]] ``` !!! tip diff --git a/docs/multisite/languages/language_api.md b/docs/multisite/languages/language_api.md index 6652aca8e5..7b5f850fcc 100644 --- a/docs/multisite/languages/language_api.md +++ b/docs/multisite/languages/language_api.md @@ -11,7 +11,7 @@ You can manage languages configured in the system with PHP API by using [`Langua To get a list of all languages in the system use [`LanguageService::loadLanguages`:](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LanguageService.html#method_loadLanguage) ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 37, 42) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 42, 47) =]] ``` ## Creating a language @@ -20,5 +20,5 @@ To create a new language, you need to create a [`LanguageCreateStruct`](/api/php Then, use [`LanguageService::createLanguage`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LanguageService.html#method_createLanguage) and pass the `LanguageCreateStruct` to it: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 43, 47) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 48, 52) =]] ``` diff --git a/docs/pim/catalog_api.md b/docs/pim/catalog_api.md index 973610403f..2caa8d2ede 100644 --- a/docs/pim/catalog_api.md +++ b/docs/pim/catalog_api.md @@ -11,7 +11,7 @@ To get information about product catalogs and manage them, use `CatalogServiceIn To get a single catalog, use `Ibexa\Contracts\ProductCatalog\CatalogServiceInterface::getCatalog()` and provide it with catalog ID, or `CatalogServiceInterface::getCatalogByIdentifier()` and pass the identifier: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 76, 78) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 81, 83) =]] ``` ## Get products in catalog @@ -20,7 +20,7 @@ To get products from a catalog, request the product query from the catalog objec Then, create a new `ProductQuery` based on it and run a product search with `ProductServiceInterface::findProduct()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 80, 86) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 85, 91) =]] ``` ## Create catalog @@ -29,7 +29,7 @@ To create a catalog, you need to prepare a `CatalogCreateStruct` that contains: Then, pass this struct to `CatalogServiceInterface::createCatalog()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 66, 74) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 71, 79) =]] ``` ## Update catalog @@ -39,5 +39,5 @@ You must pass the catalog object and a `CatalogUpdateStruct` to the method. In the following example, you update the catalog to publish it: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 88, 92) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CatalogCommand.php', 93, 97) =]] ``` diff --git a/docs/pim/price_api.md b/docs/pim/price_api.md index 9630453638..6d26b2cee5 100644 --- a/docs/pim/price_api.md +++ b/docs/pim/price_api.md @@ -12,13 +12,13 @@ To access a currency object by its code, use `CurrencyServiceInterface::getCurre To access a whole list of currencies, use `CurrencyServiceInterface::findCurrencies`. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CurrencyCommand.php', 49, 57) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CurrencyCommand.php', 52, 61) =]] ``` To create a new currency, use `CurrencyServiceInterface::createCurrency()` and provide it with a `CurrencyCreateStruct` with code, number of fractional digits and a flag indicating if the currency is enabled: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/CurrencyCommand.php', 64, 67) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/CurrencyCommand.php', 67, 71) =]] ``` ## Prices @@ -28,19 +28,19 @@ To manage prices, use `ProductPriceService`. To retrieve the price of a product in the currency for the current context, use `Product::getPrice()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 75, 78) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 79, 82) =]] ``` To retrieve the price of a product in a specific currency, use `ProductPriceService::getPriceByProductAndCurrency`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 79, 82) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 83, 86) =]] ``` To get all prices (in different currencies) for a given product, use `ProductPriceService::findPricesByProductCode`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 93, 99) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 97, 103) =]] ``` To load price definitions that match given criteria, use `ProductPriceServiceInterface::findPrices`: @@ -48,14 +48,14 @@ To load price definitions that match given criteria, use `ProductPriceServiceInt ``` php [[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 12, 16) =]] // ... -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 100, 110) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 104, 114) =]] ``` You can also use `ProductPriceService` to create or modify existing prices. For example, to create a new price for a given currency, use `ProductPriceService::createProductPrice` and provide it with a `ProductPriceCreateStruct` object: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 75, 81) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 79, 85) =]] ``` !!! note @@ -80,7 +80,7 @@ To resolve a price of a product in the currency for the current context, use eit ``` php [[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 7, 8) =]][[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 11, 12) =]] // ... -[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 111, 115) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductPriceCommand.php', 115, 119) =]] ``` ## VAT @@ -89,17 +89,17 @@ To get information about the VAT categories and rates configured in the system, VAT is configured per region, so you also need to use `RegionServiceInterface` to get the relevant region object. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 49, 50) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 54, 55) =]] ``` To get information about all VAT categories configured for the selected region, use `VatServiceInterface::getVatCategories()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 51, 56) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 56, 61) =]] ``` To get a single VAT category, use `VatServiceInterface::getVatCategoryByIdentifier()` and provide it with the region object and the identifier of the VAT category: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 57, 59) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/VatCommand.php', 62, 64) =]] ``` diff --git a/docs/pim/product_api.md b/docs/pim/product_api.md index 3d9ac22a3d..8818e04ac3 100644 --- a/docs/pim/product_api.md +++ b/docs/pim/product_api.md @@ -21,7 +21,7 @@ month_change: false Get an individual product by using the `ProductServiceInterface::getProduct()` method: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 68, 71) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 73, 76) =]] ``` Find multiple products with `ProductServiceInterface::findProducts()`. @@ -29,7 +29,7 @@ Find multiple products with `ProductServiceInterface::findProducts()`. Provide the method with optional filter, query or Sort Clauses. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 72, 82) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 77, 87) =]] ``` See [Product Search Criteria](product_search_criteria.md) and [Product Sort Clauses](product_sort_clauses.md) references for more information about how to use the [`ProductQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductQuery.html) class. @@ -39,7 +39,7 @@ See [Product Search Criteria](product_search_criteria.md) and [Product Sort Clau To create, update and delete products, use the `LocalProductServiceInterface`. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 93, 97) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 98, 102) =]] ``` To create a product, use `LocalProductServiceInterface::newProductCreateStruct()` to get a [`ProductCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-Product-ProductCreateStruct.html). @@ -47,13 +47,13 @@ Provide the method with the product type object and the main language code. You also need to set (at least) the code for the product and the required Field of the underlying content type, `name`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 83, 90) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 88, 95) =]] ``` To delete a product, use `LocalProductServiceInterface::deleteProduct()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 120, 121) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 125, 126) =]] ``` ### Product variants @@ -65,13 +65,13 @@ A `ProductVariantQuery` lets you define the offset and limit of the variant quer The default offset is 0, and limit is 25. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 57, 60) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 62, 65) =]] ``` From a variant ([`ProductVariantInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-ProductVariantInterface.html)), you can access the attributes that are used to generate the variant by using `ProductVariantInterface::getDiscriminatorAttributes()`. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 61, 68) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 66, 73) =]] ``` #### Creating variants @@ -81,7 +81,7 @@ This method takes the product and an array of [`ProductVariantCreateStruct`](/ap `ProductVariantCreateStruct` specifies the attribute values and the code for the new variant. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 70, 76) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 75, 81) =]] ``` ### Product assets @@ -91,14 +91,14 @@ You can get assets assigned to a product by using [`AssetServiceInterface`](/api Use `AssetServiceInterface` to get a single asset by providing the product object and the assets's ID as parameters: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductAssetCommand.php', 54, 56) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductAssetCommand.php', 59, 61) =]] ``` To get all assets assigned to a product, use `AssetServiceInterface::findAssets()`. You can retrieve the tags (corresponding to attribute values) of assets with the `AssetInterface::getTags()` method: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductAssetCommand.php', 57, 66) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductAssetCommand.php', 62, 71) =]] ``` ## Product types @@ -108,13 +108,13 @@ To work with product types, use [`ProductTypeServiceInterface`](/api/php_api/php Get a product type object by using `ProductTypeServiceInterface::getProductType()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductTypeCommand.php', 43, 44) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductTypeCommand.php', 48, 49) =]] ``` You can also get a list of product types with `ProductTypeServiceInterface::findProductTypes()`: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductTypeCommand.php', 47, 52) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductTypeCommand.php', 52, 57) =]] ``` ## Product availability @@ -128,14 +128,14 @@ Get the availability object with `ProductAvailabilityServiceInterface::getAvaila You can then use `ProductAvailabilityServiceInterface::getStock()` to get the stock number for the product: ```php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 104, 109) =]] } +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 109, 114) =]] } ``` To change availability for a product, use `ProductAvailabilityServiceInterface::updateProductAvailability()` with a [`ProductAvailabilityUpdateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Availability-ProductAvailabilityUpdateStruct.html) and provide it with the product object. The second parameter defines whether product is available, and the third whether its stock is infinite. The fourth parameter is the stock number: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 112, 115) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/ProductCommand.php', 117, 120) =]] ``` ## Attributes @@ -146,24 +146,24 @@ To get information about product attribute groups, use the [`AttributeGroupServi `AttributeGroupServiceInterface::findAttributeGroups()` gets attribute groups, all of them or filtered with an optional [`AttributeGroupQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-AttributeGroup-AttributeGroupQuery.html) object: ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 71, 72) =]] -[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 92, 97) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 75, 76) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 96, 102) =]] ``` To create an attribute group, use `LocalAttributeGroupServiceinterface::createAttributeGroup()` and provide it with an [`AttributeGroupCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-AttributeGroup-AttributeGroupCreateStruct.html): ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 66, 70) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 69, 75) =]] ``` To get information about product attributes, use the [`AttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html), or [`LocalAttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-LocalAttributeDefinitionServiceInterface.html) to modify attributes. ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 78, 80) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 81, 85) =]] ``` To create an attribute, use `LocalAttributeGroupServiceinterface::createAttributeDefinition()` and provide it with an [`AttributeDefinitionCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-AttributeDefinition-AttributeDefinitionCreateStruct.html): ``` php -[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 83, 89) =]] +[[= include_file('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 86, 94) =]] ``` diff --git a/docs/search/search_api.md b/docs/search/search_api.md index 73690acca1..47238e952d 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -29,8 +29,8 @@ The following command takes the content type identifier as an argument and lists ``` php hl_lines="14 16" // ... [[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 4, 7) =]]// ... -[[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 12, 14) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 31, 47) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 16, 18) =]] // ... +[[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 36, 52) =]]} ``` [`SearchService::findContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) (line 16) @@ -78,7 +78,7 @@ This enables iterating over results that are too large to handle due to memory c `BatchIterator` takes one of the available adapters ([`\Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-iterator-batchiteratoradapter.html)) and optional batch size. For example: ``` php -$query = new LocationQuery; +$query = new LocationQuery(); $iterator = new BatchIterator(new BatchIteratorAdapter\LocationSearchAdapter($this->searchService, $query)); @@ -120,7 +120,7 @@ For example, the following command lists all content items under the specified p // ... [[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 4, 9) =]] // ... -[[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 32, 52) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 37, 57) =]] ``` The same Filter can be applied to find locations instead of content items, for example: @@ -128,7 +128,7 @@ The same Filter can be applied to find locations instead of content items, for e ``` php hl_lines="17" // ... [[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 4, 9) =]]// ... -[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 32, 52) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 37, 57) =]] ``` !!! caution @@ -238,8 +238,8 @@ For more complex searches, you need to combine multiple Criteria. You can do it using logical operators: `LogicalAnd`, `LogicalOr`, and `LogicalNot`. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 43, 49) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 53, 54) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 60, 65) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 48, 54) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 58, 59) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 65, 70) =]] ``` This example takes three parameters from a command — `$text`, `$contentTypeId`, and `$locationId`. @@ -253,7 +253,7 @@ The example below uses the `LogicalNot` operator to search for all content conta that doesn't belong to the provided Section: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 45, 46) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 48, 53) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 50, 51) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 53, 58) =]] ``` ### Combining independent Criteria @@ -286,7 +286,7 @@ To sort the results of a query, use one of more [Sort Clauses](sort_clause_refer For example, to order search results by their publicationg date, from oldest to newest, and then alphabetically by content name, add the following Sort Clauses to the query: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 55, 59) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 60, 64) =]] ``` !!! tip @@ -305,7 +305,7 @@ For a list of supported Criteria and Sort Clauses, see [Search in trash referenc Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data. ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindInTrashCommand.php', 34, 41) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindInTrashCommand.php', 39, 46) =]] ``` !!! caution @@ -324,7 +324,7 @@ With aggregations you can find the count of search results or other result infor To do this, you use of the query's `$aggregations` property: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 34, 39) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 39, 44) =]] ``` The name of the aggregation must be unique in the given query. @@ -332,13 +332,13 @@ The name of the aggregation must be unique in the given query. Access the results by using the `get()` method of the aggregation: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 43, 44) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 48, 49) =]] ``` Aggregation results contain the name of the result and the count of found items: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 46, 49) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 51, 54) =]] ``` With field aggregations you can group search results according to the value of a specific field. @@ -347,14 +347,14 @@ In this case the aggregation takes the content type identifier and the field ide The following example creates an aggregation named `selection` that groups results according to the value of the `topic` field in the `article` content type: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 39, 40) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 44, 45) =]] ``` With term aggregation you can define additional limits to the results. The following example limits the number of terms returned to 5 and only considers terms that have 10 or more results: ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 34, 37) =]] +[[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 39, 42) =]] ``` To use a range aggregation, you must provide a `ranges` array containing a set of `Range` objects that define the borders of the specific range sets. diff --git a/docs/templating/render_content/render_content_in_php.md b/docs/templating/render_content/render_content_in_php.md index 5d8b97563c..8d42cdbc75 100644 --- a/docs/templating/render_content/render_content_in_php.md +++ b/docs/templating/render_content/render_content_in_php.md @@ -19,16 +19,6 @@ It's compatible with the default installation views such as `line` or `embed`. To go further with this example, you could add some dedicated views not outputting HTML but, for example, plain text, [Symfony command styled text]([[= symfony_doc =]]/console/coloring.html) or Markdown. It doesn't work with a `full` view when the [page layout](template_configuration.md#page-layout) uses `app.request`, such as the out-of-the-box template. -Append to `config/services.yaml` the command as a service: - -```yaml -services: - #… - App\Command\ViewCommand: - tags: - - { name: 'console.command', command: 'app:view' } -``` - Create the command in `src/Command/ViewCommand.php`: ```php hl_lines="57-61" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e0ebae0ef8..c19c052141 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -414,42 +414,6 @@ parameters: count: 1 path: code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DType.php - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns ArrayObject\<\(int\|string\), mixed\> so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns bool so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns float so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns int so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns null so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - - - message: '#^Method App\\Serializer\\Point2D\\ValueNormalizer\:\:normalize\(\) never returns string so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php - - message: '#^Class App\\Form\\Type\\Point2DType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' identifier: missingType.generics