My question
I'm unsure about the handling of $_POST data in a MVC architecture: Who should catch the $_POST data: The controller or the model ? Several sources say "skinny controllers, fat models", but same sources also say that a model should be strictly decoupled from the application (and example B clearly shows a "fat" model, but is not decoupled as it directly asks for POST data). For comparison let's see the same thing written in two different ways (example pseudo-code):
A.) The controller grabs $_POST values, passes it as arguments to model
// CONTROLLER
public function createSomething()
{
$model = new Model;
$model->createThis($_POST['stuff_from_form']);
}
// MODEL (expects argument)
public function createThis($stuff)
{
// and here the model method does whatever it does
}
B.) The model grabs $_POST values
// CONTROLLER
public function createSomething()
{
$model = new Model;
$model->createThis();
}
// MODEL (expects NO argument, grabs POST data directly)
public function createThis()
{
$stuff = $_POST['stuff_from_form'];
// and here the model method does whatever it does
}