私はMVCの初心者です(私の例としてcodeIgniterを使用しています)。MVCファットモデルとスキニーコントローラーを3回読んだことがありますが、これは次のとおりです。
- コントローラがモデルを呼び出し、ビューでレンダリングされるデータを渡す間、モデルはハードワークを実行します
しかし、私には1つの混乱があります。たとえば、データベース内の製品データを削除する管理ページがあり、次のコードがあります(codeIgniterを使用)。
public function deleteProduct($id = '')
    {
        if( is_digit($id))
        {
            $this->load->model('productModel');
            $this->productModel->deleteById($id);
            //oops product has images in another DB table and in server, so i need to delete it
            $success = $this->_deleteProductImages($id);
        }
        else
        {
            //redirect because of invalid param
        }
            //if success TRUE then load the view and display success
            //else load the view and display error
    }
protected function _deleteProductImages($productId)
{
        $this->load->model('productModel');
        //return array of images path
        $imgs = $this->productModel->getImagesPath($productId);
        // after i got the imgs data, then delete the image in DB that references to the $productId
        $this->productModel->deleteImage($productId);
        foreach($imgs as $imgPath)
        {
            if(file_exists $imgPath) unlink($imgPath);
        }
}
私の質問は:
シンコントローラーとファットモデルの概念では、メソッド_deleteProductImages($id)をproductModelに移動する必要がありますか、それともそのままにしておく必要がありますか?別のより良いアプローチがある場合は、ここで私を案内してください