In an MVC pattern, what is the best way to describe classes which aren't exactly models, but they work on models?
For example, I have an Order
model which represents a customer's order in the system. I want to have a class called Orders
which amongst other things, will store a collection of Order
and perform functions on those. I don't believe this belongs in the Models folder as it isn't really a model.
Another example is that the user can import orders, so I would have an Import
class which handles the import.
I don't believe these are helper classes or plugins so am not really sure where these go in terms of the folder structure.
Any help appreciated!
Edit: Just to describe the point of my Orders
class- currently, each Order
model has a validate()
function which checks an external WMS for stock. This call is VERY expensive (an old FoxPro database) and when importing orders (in which you can import multiple orders at once), rather than having 1 call to the WMS for every order, I wanted to move this validate function 1 level higher so that I can have a single call to the WMS system to get the stock levels. That is why I was going to have a class called Orders
. I agree that Orders
is really just a collection of Order
, however I am unsure where to put this method now. As Engineer Dollery
pointed out, the relationship of orders is owned by the customer (a customer has many orders), however it doesn't right to me the the function belongs on the customer.