Welcome Guest, Not a member yet? Register   Sign In
CI4 Model Is huge
#9

(09-05-2023, 07:05 AM)luckmoshy Wrote: @Mazen Yep, if you use PSR4 autoload, this is what you should expect. If I am not mistaken, at an earlier time something like this happened, so bear this in mind if you play with the module Take care: How do you organize your class and methods?

All my relations is inside the model, so once I find any model I need the returnType to be self::class
For Example:
class User extends Model {
     public function posts() {
             return (new Post())->where(['user_id' => $this->id])->findAll();
     }
}

So I decided to skip model validation and set the validation object to null as following
$this->validation = null;
$this->skipValidation();

and move all validation rules to the requests classes by using Service::validation()->run($data) instead of using $model->validate($data);
Reply


Messages In This Thread
CI4 Model Is huge - by Mazen - 09-03-2023, 02:07 AM
RE: CI4 Model Is huge - by ozornick - 09-03-2023, 03:22 AM
RE: CI4 Model Is huge - by Mazen - 09-03-2023, 03:27 AM
RE: CI4 Model Is huge - by ozornick - 09-03-2023, 04:04 AM
RE: CI4 Model Is huge - by kenjis - 09-03-2023, 07:49 PM
RE: CI4 Model Is huge - by Mazen - 09-05-2023, 04:40 AM
RE: CI4 Model Is huge - by luckmoshy - 09-05-2023, 07:05 AM
RE: CI4 Model Is huge - by Mazen - 09-06-2023, 11:20 AM
RE: CI4 Model Is huge - by kenjis - 09-05-2023, 08:55 PM
RE: CI4 Model Is huge - by kenjis - 10-24-2023, 12:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB