From 6d8d2aa3df55043b5db166bc54acbcb1440c8daa Mon Sep 17 00:00:00 2001 From: Dieter Holvoet Date: Tue, 6 Jan 2026 14:12:43 +0100 Subject: [PATCH 1/2] Fix broken hyperlink --- src/Commands/field/FieldBaseOverrideCreateCommand.php | 6 ++++-- src/Commands/field/FieldCreateCommand.php | 6 ++++-- src/Commands/field/FieldDeleteCommand.php | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Commands/field/FieldBaseOverrideCreateCommand.php b/src/Commands/field/FieldBaseOverrideCreateCommand.php index 84a0d27c0d..000b5244ef 100644 --- a/src/Commands/field/FieldBaseOverrideCreateCommand.php +++ b/src/Commands/field/FieldBaseOverrideCreateCommand.php @@ -12,6 +12,7 @@ use Drush\Attributes as CLI; use Drush\Commands\AutowireTrait; use Drush\Commands\IoTrait; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; @@ -45,7 +46,8 @@ final class FieldBaseOverrideCreateCommand extends Command public function __construct( private readonly EntityTypeManagerInterface $entityTypeManager, private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo, - private readonly EntityFieldManagerInterface $entityFieldManager + private readonly EntityFieldManagerInterface $entityFieldManager, + private readonly LoggerInterface $logger, ) { parent::__construct(); } @@ -195,7 +197,7 @@ protected function createBaseFieldOverride(string $entityType, string $bundle, s protected function logResult(BaseFieldOverride $baseFieldOverride): void { - $this->io()->success( + $this->logger->success( sprintf( 'Successfully created base field override \'%s\' on %s with bundle \'%s\'', $baseFieldOverride->getName(), diff --git a/src/Commands/field/FieldCreateCommand.php b/src/Commands/field/FieldCreateCommand.php index 3839bacbec..544ca6f7a5 100644 --- a/src/Commands/field/FieldCreateCommand.php +++ b/src/Commands/field/FieldCreateCommand.php @@ -27,6 +27,7 @@ use Drush\Event\FieldCreateFieldStorageConfigValuesEvent; use Drush\Event\FieldCreateInputOptionsEvent; use Psr\EventDispatcher\EventDispatcherInterface; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; @@ -69,6 +70,7 @@ public function __construct( private readonly ModuleHandlerInterface $moduleHandler, private readonly EntityFieldManagerInterface $entityFieldManager, private readonly EventDispatcherInterface $eventDispatcher, + private readonly LoggerInterface $logger, private readonly ?ContentTranslationManagerInterface $contentTranslationManager = null, ) { parent::__construct(); @@ -493,7 +495,7 @@ protected function getEntityDisplay(string $context): ?EntityDisplayInterface protected function logResult(FieldConfigInterface $field): void { - $this->io()->success( + $this->logger->success( sprintf( "Successfully created field '%s' on %s type with bundle '%s'", $field->get('field_name'), @@ -512,7 +514,7 @@ protected function logResult(FieldConfigInterface $field): void ]; if ($this->moduleHandler->moduleExists('field_ui')) { - $this->io()->success( + $this->logger->success( dt('Further customisation can be done through the edit form.', [ '%editForm' => Url::fromRoute($routeName, $routeParams)->setAbsolute(true)->toString(), ]), diff --git a/src/Commands/field/FieldDeleteCommand.php b/src/Commands/field/FieldDeleteCommand.php index a2dfa3c47d..7c031252e7 100644 --- a/src/Commands/field/FieldDeleteCommand.php +++ b/src/Commands/field/FieldDeleteCommand.php @@ -12,6 +12,7 @@ use Drush\Attributes as CLI; use Drush\Commands\AutowireTrait; use Drush\Commands\IoTrait; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; @@ -47,7 +48,8 @@ final class FieldDeleteCommand extends Command public function __construct( private readonly EntityTypeManagerInterface $entityTypeManager, - private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo + private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo, + private readonly LoggerInterface $logger ) { parent::__construct(); } @@ -286,7 +288,7 @@ protected function deleteFieldConfig(FieldConfigInterface $fieldConfig): void $message = 'There was a problem removing the !field from the !type content type.'; } - $this->io()->success( + $this->logger->success( dt($message, ['!field' => $fieldConfig->label(), '!type' => $bundleLabel]) ); } From 0dc6577bc53ec6598f8206b72aac6cc0bc648905 Mon Sep 17 00:00:00 2001 From: Dieter Holvoet Date: Tue, 6 Jan 2026 15:10:47 +0100 Subject: [PATCH 2/2] Revert unnecessary changes & fix cs --- src/Commands/field/FieldBaseOverrideCreateCommand.php | 6 ++---- src/Commands/field/FieldCreateCommand.php | 2 ++ src/Commands/field/FieldDeleteCommand.php | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Commands/field/FieldBaseOverrideCreateCommand.php b/src/Commands/field/FieldBaseOverrideCreateCommand.php index 000b5244ef..84a0d27c0d 100644 --- a/src/Commands/field/FieldBaseOverrideCreateCommand.php +++ b/src/Commands/field/FieldBaseOverrideCreateCommand.php @@ -12,7 +12,6 @@ use Drush\Attributes as CLI; use Drush\Commands\AutowireTrait; use Drush\Commands\IoTrait; -use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; @@ -46,8 +45,7 @@ final class FieldBaseOverrideCreateCommand extends Command public function __construct( private readonly EntityTypeManagerInterface $entityTypeManager, private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo, - private readonly EntityFieldManagerInterface $entityFieldManager, - private readonly LoggerInterface $logger, + private readonly EntityFieldManagerInterface $entityFieldManager ) { parent::__construct(); } @@ -197,7 +195,7 @@ protected function createBaseFieldOverride(string $entityType, string $bundle, s protected function logResult(BaseFieldOverride $baseFieldOverride): void { - $this->logger->success( + $this->io()->success( sprintf( 'Successfully created base field override \'%s\' on %s with bundle \'%s\'', $baseFieldOverride->getName(), diff --git a/src/Commands/field/FieldCreateCommand.php b/src/Commands/field/FieldCreateCommand.php index 544ca6f7a5..34814317b0 100644 --- a/src/Commands/field/FieldCreateCommand.php +++ b/src/Commands/field/FieldCreateCommand.php @@ -26,6 +26,7 @@ use Drush\Event\FieldCreateFieldConfigValuesEvent; use Drush\Event\FieldCreateFieldStorageConfigValuesEvent; use Drush\Event\FieldCreateInputOptionsEvent; +use Drush\Log\SuccessInterface; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; @@ -495,6 +496,7 @@ protected function getEntityDisplay(string $context): ?EntityDisplayInterface protected function logResult(FieldConfigInterface $field): void { + assert($this->logger instanceof SuccessInterface); $this->logger->success( sprintf( "Successfully created field '%s' on %s type with bundle '%s'", diff --git a/src/Commands/field/FieldDeleteCommand.php b/src/Commands/field/FieldDeleteCommand.php index 7c031252e7..a2dfa3c47d 100644 --- a/src/Commands/field/FieldDeleteCommand.php +++ b/src/Commands/field/FieldDeleteCommand.php @@ -12,7 +12,6 @@ use Drush\Attributes as CLI; use Drush\Commands\AutowireTrait; use Drush\Commands\IoTrait; -use Psr\Log\LoggerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; @@ -48,8 +47,7 @@ final class FieldDeleteCommand extends Command public function __construct( private readonly EntityTypeManagerInterface $entityTypeManager, - private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo, - private readonly LoggerInterface $logger + private readonly EntityTypeBundleInfoInterface $entityTypeBundleInfo ) { parent::__construct(); } @@ -288,7 +286,7 @@ protected function deleteFieldConfig(FieldConfigInterface $fieldConfig): void $message = 'There was a problem removing the !field from the !type content type.'; } - $this->logger->success( + $this->io()->success( dt($message, ['!field' => $fieldConfig->label(), '!type' => $bundleLabel]) ); }