vanilophp / framework

The truly Laravel E-commerce Framework
https://vanilo.io
MIT License
816 stars 103 forks source link

Remove hard coded factory in `MasterProduct` #162

Closed netzknecht closed 1 year ago

netzknecht commented 1 year ago

I think it's not right to hard code the factory here. Over and beyond, the referenced factory class is not available.

fulopattila122 commented 1 year ago

This class is only required for unit tests, and shouldn't be called elsewhere. It's a standard Laravel technique: https://laravel.com/docs/10.x/eloquent-factories

What is the problem/use-case that you're trying to solve?

netzknecht commented 1 year ago

For sure, that's a common Laravel technique. But if I extend the MasterProduct-class from the vanilo-frameworks package in my project, the hard coded factory class is not found, if I run my application tests. It can be solved by overwriting the newFactory()-method in the inherited MasterProduct-class of my application, but when I look to the code of the other models like Products, MasterProductVariant from the vanillo-framework package, the factory class isn't hard coded anywhere.

Is there any way to communicate in German language you?

netzknecht commented 1 year ago

How should I handle the revision of commits? Edit and push force them or create a new commit?

fulopattila122 commented 1 year ago

It can be solved by overwriting the newFactory()-method in the inherited MasterProduct-class of my application, but when I look to the code of the other models like Products, MasterProductVariant from the vanillo-framework package, the factory class isn't hard coded anywhere.

Yes, please replace it in your app if you need to. The other classes don't have these, because tests for those are using the legacy factories; a thing that will be changed soon.

Is there any way to communicate in German language you?

Yes, but only in person :) The language we use here on Github is solely English.