Welcome Guest, Not a member yet? Register   Sign In
Can a model contains business validation operations or low level data handling stuff ?
#1

[eluser]Rushino[/eluser]
Hello,

I know model is for data management from a bd (for insert, update, select, etc.) but can a model also contains low level methods ?

Example: I have an insert_entry(...) from an user model but that should only insert data to the DB. I would'nt encrypt the password in this method.. i may want a method that is called create_user instead that do this job and do some others stuff such send an email.

Does that go in the model or that should go in a library?

Thanks.
#2

[eluser]toopay[/eluser]
I prefer to keep "single responsibility principle". A class should have one, and only one, reason to change.
#3

[eluser]Rushino[/eluser]
What you mean ?
#4

[eluser]toopay[/eluser]
[quote author="Rushino" date="1305228224"]... can a model also contains low level methods ?[/quote]

That will break above principle, but that my own rules ;-)
#5

[eluser]Rushino[/eluser]
nah its okay i made a library for it.. so i am on the good path.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB