From 2278548781eeac8954cce8548428b0c9c0397374 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 29 Oct 2023 10:23:02 +0300 Subject: [PATCH 1/2] Updated upgrade documentation --- docs/prologue/upgrade-guide/3.x.md | 26 +++++++++++++++----------- docs/prologue/upgrade-guide/4.x.md | 27 ++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/docs/prologue/upgrade-guide/3.x.md b/docs/prologue/upgrade-guide/3.x.md index 6d88c676..663a5a3a 100644 --- a/docs/prologue/upgrade-guide/3.x.md +++ b/docs/prologue/upgrade-guide/3.x.md @@ -16,7 +16,7 @@ - [Changing the name of an action column in the database](#changed-action-repository) - [Action storage directory changed](#actions-location) -### Call Upgrade Command +## The easiest way to upgrade > Note > If you used inheritance of actions from other actions, then you will need to process these files manually. @@ -24,7 +24,9 @@ For your convenience, we have created an upgrade console command: ```bash +composer require dragon-code/laravel-migration-actions:^3.0 php artisan migrate:actions:upgrade +php artisan migrate ``` It will do the following: @@ -34,6 +36,7 @@ It will do the following: - Replace the `up` method with `__invoke` if the class does not have a `down` method - Replace named classes with anonymous ones - Create a configuration file according to the data saved in your project +- Changes properties from `snake_case` to `camelCase` ## Updating Dependencies @@ -45,7 +48,7 @@ Laravel Actions now requires PHP 8.0.2 or greater. You should update the following dependency in your application's `composer.json` file: -- `dragon-code/laravel-actions` to `^3.0` +- `dragon-code/laravel-migration-actions` to `^3.0` ## Configuration @@ -57,7 +60,8 @@ php artisan vendor:publish --provider="DragonCode\LaravelActions\ServiceProvider ## Actions Location -Move the action files to the `actions` folder in the project root, or update the `actions.path` option in the configuration file. +Move the action files to the `actions` folder in the project root, or update the `actions.path` option in the +configuration file. ## Parent Namespace @@ -93,14 +97,14 @@ Just call the `php artisan migrate` command to make changes to the action reposi Make sure all overridden properties are typed: -``` -protected $once >> protected bool $once -protected $transactions >> protected bool $transactions -protected $transaction_attempts >> protected int $transactionAttempts -protected $environment >> protected string|array|null $environment -protected $except_environment >> protected string|array|null $exceptEnvironment -protected $before >> protected bool $before -``` +| Old Name | New Name | +|---------------------------------|--------------------------------------------------| +| protected $once | protected bool $once | +| protected $transactions | protected bool $transactions | +| protected $transaction_attempts | protected int $transactionAttempts | +| protected $environment | protected string\|array\|null $environment | +| protected $except_environment | protected string\|array\|null $exceptEnvironment | +| protected $before | protected bool $before | ## Added recursive search for actions in a folder diff --git a/docs/prologue/upgrade-guide/4.x.md b/docs/prologue/upgrade-guide/4.x.md index 893dbfd6..96cd7b7f 100644 --- a/docs/prologue/upgrade-guide/4.x.md +++ b/docs/prologue/upgrade-guide/4.x.md @@ -2,7 +2,7 @@ ### High Impact Changes -- [Renamed project namespace](#renamed-project-namespace) +- [Rename package name](#rename-package-name) - [Changing the names of console commands](#changing-the-names-of-console-commands) ### Medium Impact Changes @@ -13,7 +13,27 @@ - [Changed the default name of the table for storing actions](#changed-the-default-name-of-the-table-for-storing-actions) -## Renamed project namespace +## The easiest way to upgrade + +> Note +> If you used inheritance of actions from other actions, then you will need to process these files manually. + +For your convenience, we have created an upgrade console command: + +```bash +composer remove dragon-code/laravel-migration-actions +composer require dragon-code/laravel-actions:^4.0 +php artisan actions:upgrade +php artisan migrate +``` + +It will do the following: + +- Renaming manually invoked commands in a project to a new name + +## Updating Dependencies + +### Rename package name You should update the following dependency in your application's `composer.json` file: @@ -75,4 +95,5 @@ DragonCode\LaravelActions\Constants\Names::ACTIONS The new table name is `actions`. -You can also specify any name in the application [settings](https://github.com/TheDragonCode/laravel-actions/blob/main/config/actions.php). +You can also specify any name in the +application [settings](https://github.com/TheDragonCode/laravel-actions/blob/main/config/actions.php). From e7da32335503c8f8503cb061c82c075154b01881 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 29 Oct 2023 10:28:32 +0300 Subject: [PATCH 2/2] Fixed Illegal offset type --- src/Processors/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Processors/Status.php b/src/Processors/Status.php index 10741428..1158153c 100644 --- a/src/Processors/Status.php +++ b/src/Processors/Status.php @@ -70,7 +70,7 @@ protected function getData(): array protected function getStatusFor(array $completed, string $action): string { if ($batch = Arr::get($completed, $action)) { - return "[$batch] $this->statusRan"; + return sprintf('[%s] %s', $batch, $this->statusRan); } return $this->statusPending;