Let's say that model insert data to database.
class Model
{
public function insert($value) {
// putting $value to database to integer field
}
}
I want to convert $value
to int by (int) $value
to prevent the insertion of the non-numeric value.
Where should I do this? In model method or in controller?
class Controller
{
public function indexAction() {
$model = new Model;
$model->insert($_POST['user_id']);
}
}