From b91b3d998f086fb4cff37516493c169f39a82862 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Sat, 30 Sep 2023 12:26:08 +0200 Subject: [PATCH] Rename ListModels as ListRecords --- MIGRATION.md | 2 +- config/services.yml | 4 ++-- lib/Console/InstallCommand.php | 4 +++- lib/Console/ListConnectionsCommand.php | 2 +- lib/Console/{ListModelsCommand.php => ListRecordsCommand.php} | 4 ++-- tests/lib/Console/ListModelsCommandTest.php | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) rename lib/Console/{ListModelsCommand.php => ListRecordsCommand.php} (88%) diff --git a/MIGRATION.md b/MIGRATION.md index ca6d5f0..1b73a6b 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -9,7 +9,7 @@ ### New features - Added a `ConfigBuilder`, to follow ICanBoogie/Config changes. Use ActiveRecord's `ConfigBuilder`. -- Added the console commands `activerecord:connections:list` and `activerecord:models:list`, with aliases `activerecord:connections` and `activerecord:models` respectively. +- Added the console commands `activerecord:connections` and `activerecord:records` (alias `activerecords`). - Configures `StaticModelResolver`. ### Backward Incompatible Changes diff --git a/config/services.yml b/config/services.yml index 65ed2b0..4c5f687 100644 --- a/config/services.yml +++ b/config/services.yml @@ -24,8 +24,8 @@ services: # Console - ICanBoogie\Binding\ActiveRecord\Console\ListModelsCommand: - class: ICanBoogie\Binding\ActiveRecord\Console\ListModelsCommand + ICanBoogie\Binding\ActiveRecord\Console\ListRecordsCommand: + class: ICanBoogie\Binding\ActiveRecord\Console\ListRecordsCommand arguments: $style: '%console.style.table%' tags: [ console.command ] diff --git a/lib/Console/InstallCommand.php b/lib/Console/InstallCommand.php index 429ae34..cc89b57 100644 --- a/lib/Console/InstallCommand.php +++ b/lib/Console/InstallCommand.php @@ -86,7 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $rows[] = [ $activerecord_class, - isset($already_installed[$activerecord_class]) ? "Already" : (isset($installed[$activerecord_class]) ? "Yes" : "No"), + isset($already_installed[$activerecord_class]) + ? "Already" + : (isset($installed[$activerecord_class]) ? "Yes" : "No"), $errors[$activerecord_class] ?? "", ]; } diff --git a/lib/Console/ListConnectionsCommand.php b/lib/Console/ListConnectionsCommand.php index bad2345..95c6b55 100644 --- a/lib/Console/ListConnectionsCommand.php +++ b/lib/Console/ListConnectionsCommand.php @@ -9,7 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('activerecord:connections', "List active record connections", [ 'activerecord:connections:list' ])] +#[AsCommand('activerecord:connections', "List active record connections")] final class ListConnectionsCommand extends Command { public function __construct( diff --git a/lib/Console/ListModelsCommand.php b/lib/Console/ListRecordsCommand.php similarity index 88% rename from lib/Console/ListModelsCommand.php rename to lib/Console/ListRecordsCommand.php index 995e6ff..3af752d 100644 --- a/lib/Console/ListModelsCommand.php +++ b/lib/Console/ListRecordsCommand.php @@ -9,8 +9,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('activerecord:models', "List ActiveRecord models", [ 'activerecord:models:list' ])] -final class ListModelsCommand extends Command +#[AsCommand('activerecord:records', "List ActiveRecords", [ 'activerecords' ])] +final class ListRecordsCommand extends Command { public function __construct( private readonly Config $config, diff --git a/tests/lib/Console/ListModelsCommandTest.php b/tests/lib/Console/ListModelsCommandTest.php index 14a6ae3..da30c5e 100644 --- a/tests/lib/Console/ListModelsCommandTest.php +++ b/tests/lib/Console/ListModelsCommandTest.php @@ -2,7 +2,7 @@ namespace Test\ICanBoogie\Binding\ActiveRecord\Console; -use ICanBoogie\Binding\ActiveRecord\Console\ListModelsCommand; +use ICanBoogie\Binding\ActiveRecord\Console\ListRecordsCommand; use ICanBoogie\Console\Test\CommandTestCase; use Test\ICanBoogie\Binding\ActiveRecord\Acme\Node; use Test\ICanBoogie\Binding\ActiveRecord\Acme\NodeModel; @@ -15,7 +15,7 @@ public static function provideExecute(): array [ 'activerecord:models', - ListModelsCommand::class, + ListRecordsCommand::class, [], [ Node::class,