This is a tumblelog, kinda like a blog but with short-form, mixed-media posts with stuff I like. Scroll down a bit to start reading, or a bit more to read more about me.
iwaffles:
So you do form validation in the controller in CI?
mtheoryx83:
well, they may not do well with bugs, but if it gets bad enough, it's easily and legally forked
mtheoryx83:
iwaffles: yes
iwaffles:
Interesting..
jtaby:
mtheoryx83, ok, but what's the point, if it's not legitimit
mtheoryx83:
it's totally logical
mtheoryx83:
jtaby: what's legitimate and what's not?
iwaffles:
mtheoryx83: So is doing it in the model :-P
jtaby:
mtheoryx83, not legitimate in a legal sense, in a social sense
mtheoryx83:
iwaffles: no, not in the model
jtaby:
I guess "official"
iwaffles:
Why not?
mtheoryx83:
validation is logic
mtheoryx83:
logic goes in the controller
jtaby:
mtheoryx83, in Rails, the concept is that validation is done in the model, since that's where the data goes
iwaffles:
I guess you could think of it that way
jtaby:
and keeping validation close to the data ensures the firewall
iwaffles:
It really depends
* bnewton has quit (Success)
mtheoryx83:
jtaby: the real "community" of serious users wouldn't use a bug-ridden "official" one if there's a better option
* vang (n=repol47@65-205-124-91.pool.ukrtel.net) has joined #codeigniter
mtheoryx83:
jtaby: validation isn't about the data
iwaffles:
As long as you have consistency throughout your app it doesn't really matter
jtaby:
i.e. you may be inserting data into the model from multiple places
jtaby:
mtheoryx83, how so?
mtheoryx83:
validation is rules on form fields
mtheoryx83:
it's logic in the strictest sense
jtaby:
or you can look at it as: validation is the set of invariants that the data must pass through
jtaby:
it defines the data
jtaby:
in a sense
mtheoryx83:
jtaby: I don't think it defines the data. Your model could be perfectly able to deal with someone who has a first name that is 40 characters long, but in the context of a given controller, you may want to limit that input. that's logic.
mtheoryx83:
crappy example, i know
mtheoryx83:
i can see it both ways
jtaby:
mtheoryx83, In true MVC, the model is application specific
mtheoryx83:
but i think the controller is better because if your form data hasn't passed validation, it's not even "data" that your model should give two shits about yet
* el2ro has quit ("ChatZilla 0.9.84 [Firefox 3.0.8/2009032609]")
jtaby:
But like I said, you can be potentially inserting data into the model from mutliple places
mtheoryx83:
of course, I could be so accustomed to CI's loose mvc that I'm not sure how it's done elsewhere
jtaby:
having the validation in your controller means you're only checking through that one gateway
iwaffles:
:-P
mtheoryx83:
yeah, i see what you mean
jtaby:
i suppose it can work either way
mtheoryx83:
I say we just take whatever from $_POST and put it right in the db
mtheoryx83:
j/k
jtaby:
mtheoryx83, here's why I think there's a confusion
jtaby:
Rails, Symfony, CI, Cake, Django
jtaby:
none of these use MVC
jtaby:
it's a lie
jtaby:
you've been cheated out of a design pattern
jtaby:
it uses an n-tiered architecture, not MVC
mtheoryx83:
It's just like the cake, it's a lie
jtaby:
MVC is organized into a triangle
jtaby:
it's not a linear pattern
mtheoryx83:
I've been thinking about that a bit as well