myth-auth icon indicating copy to clipboard operation
myth-auth copied to clipboard

Inconsistent Models

Open MGatner opened this issue 2 years ago • 2 comments

Model use throughout the library is inconsistent, src/Config/Services.php being a central discrepancy:

  50     Parameter #1 $groupModel of class Myth\Auth\Authorization\FlatAuthorization constructor expects Myth\Auth\Authorization\GroupModel, CodeIgniter\Model given.            
  50     Parameter #2 $permissionModel of class Myth\Auth\Authorization\FlatAuthorization constructor expects Myth\Auth\Authorization\PermissionModel, CodeIgniter\Model given.  
  52     Parameter #1 $model of method Myth\Auth\Authorization\FlatAuthorization::setUserModel() expects Myth\Auth\Models\UserModel, CodeIgniter\Model given.                    

This library should decide one of two ways:

  • Support any Model class, and either loosen class methods or add interfaces for required methods
  • Require specific models (like GroupModel) and developers can extend those models if they need to

MGatner avatar Apr 27 '22 14:04 MGatner

And it would be concise if we move GroupModel and PermissionModel inside Authorization folder to the respective Models folder. What do you think about it ?

manageruz avatar Jun 22 '22 08:06 manageruz

Yes, I lobbied for this on Shield and we went with that. It's a pain always having to remember which Models folder to go looking for 😱

MGatner avatar Jun 22 '22 10:06 MGatner