thephpleague / factory-muffin

Enables the rapid creation of objects for testing
https://factory-muffin.thephpleague.com/
MIT License
532 stars 72 forks source link

No explicit support by FactoryGenerator #460

Closed antonmarin closed 4 years ago

antonmarin commented 5 years ago

FactoryGenerator uses getPk(), pk() methods or id, _id fields. But my record can have not all of, and i will get error while inserting record (smth like field cannot be null).

So may be implement some interface or add support for yii2, it uses method getPrimaryKey(), which return array of fields of pk? https://www.yiiframework.com/doc/api/2.0/yii-db-baseactiverecord#getPrimaryKey()-detail

GrahamCampbell commented 4 years ago

Thanks for getting in touch, and sorry for the long delay. I think https://github.com/thephpleague/factory-muffin/pull/469 will do what you need?

antonmarin commented 4 years ago

Hi! Great looks like it would help. Thanks for feedback.