Connection problem with Fixture Factory v3.0

I’m having a problem when trying to bake a new factory.
It seems the db configuration is not being found and used?

Stack Trace:
- /Users/dondrake/Sites/ck5/vendor/vierge-noire/cakephp-fixture-factories/src/Command/BakeFixtureFactoryCommand.php:219
- /Users/dondrake/Sites/ck5/vendor/cakephp/cakephp/src/Console/BaseCommand.php:192
- /Users/dondrake/Sites/ck5/vendor/cakephp/cakephp/src/Console/CommandRunner.php:327
- /Users/dondrake/Sites/ck5/vendor/cakephp/cakephp/src/Console/CommandRunner.php:168
- /Users/dondrake/Sites/ck5/bin/cake.php:10
- [main]:

[TypeError] Cannot assign null to property Bake\Command\BakeCommand::$connection of type string in /Users/dondrake/Sites/ck5/vendor/cakephp/bake/src/Utility/CommonOptionsTrait.php on line 77

Stack Trace:

Bake\Command\BakeCommand->extractCommonProperties() - ROOT/vendor/vierge-noire/cakephp-fixture-factories/src/Command/BakeFixtureFactoryCommand.php, line 219
CakephpFixtureFactories\Command\BakeFixtureFactoryCommand->execute() - CORE/src/Console/BaseCommand.php, line 192
Cake\Console\BaseCommand->run() - CORE/src/Console/CommandRunner.php, line 327
Cake\Console\CommandRunner->runCommand() - CORE/src/Console/CommandRunner.php, line 168
Cake\Console\CommandRunner->run() - ROOT/bin/cake.php, line 10
[main] - [main], line 0

What I’ve done so far
The traditional, built-in Cake fixtures work with the testing db and several unit tests that use fixture data work fine.

I composed in the new version of Fixture Factory and loaded the plugin as instructed in the Setup instructions.

Running the bake fixture_factory <model-name> produces the error shown.

My original efforts were in a Docker environment. The db config in this installation was a url in an env variable.

Thinking I might have something wrong there I made a new CakePHP 5.x app and did the setup for Fixture Factory. In this case I made the db config by setting the various array keys appropriately.

The home page shows green for all the Cake pieces.

Baking a new Factory yields the same error.

Can confirm this error. Will look into it.

See fix common options missing and warning by LordSimal · Pull Request #231 · vierge-noire/cakephp-fixture-factories · GitHub

1 Like

That’s gonna fix it for me!

Back to my happy-place with fixtures

Fixed in v3.0.1. Thanks @dreamingmind for reporting the issue.Thanks @KevinPfeifer for the fix.