This question is about a concept in MVC:
Supposing I have two basics entities in my system: the Post that has many PostImage (a 1:N relation).
At certain moment, I’m editing a Post and I want to delete some PostImage.
Here is my doubt: which Controller is responsible for performing the action to delete the PostImage?
a) The PostsController (the PostImage only exists inside the Post) ?
b) The PostsImageController?
c) Both are correct choices.
Note: I’m using CakePHP, but I think this is irrelevant because MVC is a concept, right?
PostImagesControlleris the one responsible for telling thePostImageModelto delete a record.What you can do inside the
PostsControlleris call thedelete()method from thePostImagemodel, assuming you’ve related them correctly.