I'm using PHP Codeigniter to build a web application.
In my controller, I call a model (say the "user" object) which has several properties and methods. Some of these properties contain sensitive data like hashed passwords, etc.
I need this object in the view, but I don't want to pass along the sensitive properties to the view.
I can think of one way to do this - which is to unset each sensitive property individually before passing the entire object to the view, but this seems too long and verbose (as seen in the code below):
unset($this->user->hashed_pwd);
unset($this->user->security_question);
...(and so on)
Does anybody know of a shorter / simpler way to sanitize such an object for the view? Or is there a better practice for doing this?