MVC - Sanitizing data, where?
Posted
by dierre
on Stack Overflow
See other posts from Stack Overflow
or by dierre
Published on 2010-03-29T14:01:31Z
Indexed on
2010/03/29
14:03 UTC
Read the original article
Hit count: 211
I'm using CakePHP but it's a question about the MVC pattern. I have in my form the input-text for the tags (separated by commas). To add the tags I've created a Tag model method that basically check if the tag exists and then add the new tag or just a new unit in the tag counter (the Tag model has these fields: id, name, slug, count). In the controller I explode the tags field and pass one tag at a time. The question is: where do I sanitize data? In the controller or in the model method? I think it should be in the controller because that's where I explode but in term of reusability I think I should sanitize data in the model. What do you think?
© Stack Overflow or respective owner