user2081339
user2081339

Reputation: 101

Kohana - validation issue

Recently I started with Kohana and everything is fine to the moment, but I have a question:

Where I should do my form validations (registration form as example) in the controller or in the model? I saw examples in kohana's documentation and they used the controller to do these things, but I find that it's more confortable for me to do them in the model. Is it wrong or ..?

Thanks.

Upvotes: 0

Views: 59

Answers (2)

zombor
zombor

Reputation: 3257

You shouldn't have ANY "fat" classes. Fat classes means you have too much code in there, and the class is likely violating SRP. Don't restrict your classes to MVC and you'll be much better off.

Things like validation belong in their own class, and used by your business logic.

Upvotes: 0

Meitham
Meitham

Reputation: 9670

in an MVC architecture, always aim to have fat models. everything else should be slim.

Upvotes: 2

Related Questions