In an MVC application, I have an array of arrays(rows) being sent to the controller from the view. All rows from the array will represent a row in the database.
I’m stuck at the point where:
– I can define a function, that accepts the array of all rows, in the model and loop the rows there.
– Or I can define a function that accepts a single row, and call it in a loop in the controller.
Which method is the right(from a MVC point of view) one?
EDIT:
The question is should I do:
$model->insertData($arrayOfRows);
or
foreach($arrayOfRows as $row) {
$model->insertRow($row);
}
So I ended up using the first solution:
$model->insertData($arrayOfRows);and loop the array of rows inside the model.