vierge-noire / cakephp-fixture-factories

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

Set display field if field is not defined #155

Closed pabloelcolombiano closed 2 years ago

pabloelcolombiano commented 2 years ago

When setting the display field of a factory's table only, the factory could accept a simple string as parameter.

Example 1:

CountryFactory::make(['name' => 'Portugal'])->getEntity();

would also be written:

CountryFactory::make('Portugal')->getEntity();

Example 2:

CityFactory::make()->with('Country', ['name' => 'Portugal'])->getEntity();

would also be written:

CityFactory::make()->with('Country', 'Portugal')->getEntity();

The risk behind this is if the display field of a table changes, which: