vierge-noire / cakephp-fixture-factories

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

Create a setField method to set a single field #114

Closed pabloelcolombiano closed 3 years ago

pabloelcolombiano commented 3 years ago

The first argument should be the key, the second the value.

This should be RC with the actual implementation

pabloelcolombiano commented 3 years ago

We might need for RC to simply create an additional setField(string $key, mixed $value) method.

How to use it: ArticleFactory::make()->setField('name', 'Mexico');

It is more convenient than the patchData, which requires typing arrays.

pakacuda commented 3 years ago

You mean it is more convenient than patchdData when setting one single field? Or do you see other use cases when this is also more convenient?

pabloelcolombiano commented 3 years ago

Yes, more convenient when setting one single field. It is simply easier to type, and occurs often.

pakacuda commented 3 years ago

Then fine with me for adding it