zenstruck / foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html
MIT License
611 stars 63 forks source link

Deprecate `addState()` in favor of `withAttributes()` #478

Closed mpdude closed 3 months ago

mpdude commented 12 months ago

What is the semantic difference between using Factory::addState() and Factory::withAttributes()?

The former seems to simply dispatch to the latter.

Is there more intention behind it and should I be careful when I use which?

kbond commented 11 months ago

No difference, it's really just a way to be more explicit when writing state methods. I think I'd be ok to deprecate addState - wdyt @nikophil?

nikophil commented 11 months ago

yes, I'm fine with it, moreover, in the version with "split factories", addState() and withAttributes() are in the same class

kbond commented 3 months ago

Fixed in #493.