tattersoftware / codeigniter4-schemas

Database schema management, for CodeIgniter 4
MIT License
22 stars 10 forks source link

model handler: only try to instantiate what is instantiable #49

Open mkuettel opened 6 months ago

mkuettel commented 6 months ago

When i was trying to run PHPUnit tests using the database they always instantly failed as soon as a Model with relations got used, because of the automatic scanning which tries to instaniate one of my abstract classes in my project:

Error: Cannot instantiate abstract class

While there is a try-catch block surrounding the new this will not catch this error, so instead use the RelectionClass is instantiable to check whether the class can be instantiated before doing so.

mkuettel commented 6 months ago

I can adjust this PR accordingly, please let me know what you think.