cakephp-fixture-factories icon indicating copy to clipboard operation
cakephp-fixture-factories copied to clipboard

PersistCommand and number argument: default value should be a string

Open fidrebg opened this issue 10 months ago • 0 comments

Description of the problem

Console Input Options does not support mixed value anymore. Only string, bool and null. So if you try the command you get the following error:

Cake\Console\ConsoleInputOption::__construct(): Argument #5 ($default) must be of type string|bool|null, int given

Versions

Cakephp: 5.0.6 Cakephp-fixture-factories: 3.0.2

Possible solution

In src/Command/PersistCommand.php line 65

Replace

->addOption('number', [ 'help' => 'Number of entities to persist.', 'short' => 'n', 'default' => 1, ])

With

->addOption('number', [ 'help' => 'Number of entities to persist.', 'short' => 'n', 'default' => '1', ])

fidrebg avatar Apr 05 '24 10:04 fidrebg