Major Release
-
New Major release still with a minimum requirement of PHP 8.1, but not backward compatible with the 4.x & prior versions of this package
-
Added \LeanOrm\Exceptions\BaseException, all LeanOrm Exception classes now extend this class instead of \Exception. You can catch \LeanOrm\Exceptions\BaseException to catch all LeanOrm generated exceptiopns.
-
Changed the method signatures of belongsTo, hasOne, hasMany & hasManyThrough in the Model class
-
belongsTo, hasOne, hasMany & hasManyThrough can now automatically use reflection on the Model class whose name is specified in the foreign_models_class_name parameter to set default values for the parameters below. These parameters can be omitted in calls to belongsTo, hasOne, hasMany & hasManyThrough if foreign_models_class_name is passed to these methods in addition to their required parameters
- foreign_table_name
- primary_key_col_in_foreign_table
- foreign_models_record_class_name
- foreign_models_collection_class_name
-
If you omit the foreign_models_class_name parameter when calling any of belongsTo, hasOne, hasMany & hasManyThrough, you must pass the foreign_table_name & primary_key_col_in_foreign_table parameters. In this situation, foreign_models_class_name, foreign_models_record_class_name & foreign_models_collection_class_name will be automatically assigned the values \LeanOrm\Model::class, \LeanOrm\Model\Record::class & \LeanOrm\Model\Collection::class respectively.
-
It is strongly recommended that you use PHP 8's named argument syntax when calling any of belongsTo, hasOne, hasMany & hasManyThrough, to promote more readable & easy to understand code whereever you define Model relationships within your applications.
Full Changelog: 4.1.1...5.0.0