Welcome Guest, Not a member yet? Register   Sign In
Validation callback function inside model
#2

[eluser]gtech[/eluser]
Not sure I agree with moving the validation to the model.. I use the models for processing data for database manipulation, managing rollbacks, error logging etc. I would suggest that the controller should be dealing with user interface interactions (parsing url information, building variables to pass to a view, form validation etc)

extract from documentation:

-----------------------
What is a Model?

Models are PHP classes that are designed to work with information in your database.
-----------------------

if your function is getting messy you can extract code to libraries (for reuse) OR create an _ function in the controller ( _ means you cannot load it from the browser)

e.g.

Code:
..
/****
*/
fucntion external() {
  $data=$this->_internal();
  echo $data;
}
/****
*/
fucntion _internal() {
  return "I like to teach the world to sing";
}


Messages In This Thread
Validation callback function inside model - by El Forum - 11-06-2007, 04:13 AM
Validation callback function inside model - by El Forum - 11-06-2007, 04:36 AM
Validation callback function inside model - by El Forum - 11-06-2007, 05:16 AM
Validation callback function inside model - by El Forum - 11-06-2007, 05:26 AM
Validation callback function inside model - by El Forum - 11-06-2007, 05:35 AM
Validation callback function inside model - by El Forum - 11-06-2007, 05:48 AM
Validation callback function inside model - by El Forum - 11-06-2007, 05:55 AM
Validation callback function inside model - by El Forum - 11-06-2007, 06:10 AM
Validation callback function inside model - by El Forum - 11-06-2007, 06:39 AM
Validation callback function inside model - by El Forum - 11-06-2007, 07:03 AM
Validation callback function inside model - by El Forum - 11-06-2007, 07:13 AM
Validation callback function inside model - by El Forum - 11-06-2007, 07:37 AM
Validation callback function inside model - by El Forum - 11-06-2007, 07:39 AM
Validation callback function inside model - by El Forum - 11-06-2007, 07:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB