vierge-noire / cakephp-fixture-factories

CakePHP Fixture Factories
https://vierge-noire.github.io/
MIT License
83 stars 21 forks source link

Add smart default data that is required by schema. #243

Closed dereuromark closed 7 months ago

dereuromark commented 8 months ago

Resolving https://github.com/vierge-noire/cakephp-fixture-factories/issues/241

The map is configurable by the end user, so they can add their own map of fields to faker. I think we might want to make it more customizable, so that you can also pass params. Otherwise, we can also use literals, and always verbosely add the full faker method call in to the map.

Smart model display field behavior could also be put into the configure map, maybe using _displayField as key. This way people can also add their own there.

In my case it created

        return [
            'name' => $faker->name(),
            'shortdescription' => $faker->text(255),
            'created' => $faker->datetime(),
            'modified' => $faker->datetime(),
        ];

as those fields need to be filled (not null).

dereuromark commented 7 months ago

no feedback yet after >1month?