mboyd4546
mboyd4546

Reputation: 23

acceptable MVC parameter usage

would it be considered a valid implementation if I do not use the model for certain parameters? For example a webform posting values directly to the controller which then passes them to another class. Is it necessary to make sure that all the fields in the webform are also referenced/stored in the model?

Upvotes: 1

Views: 25

Answers (3)

ExpertGeek
ExpertGeek

Reputation: 26

I consider it a valid implementation, but suggest that you do this only if the parameters you want to exclude from the Model are absolutely NOT going to be used by the View (other than for confirmation of data entry in your webform), AND there is no need for the parameters to be referenced again once handled by the Controller.

Upvotes: 1

dustyhoppe
dustyhoppe

Reputation: 1813

I would consider it valid implementation if you decided not to use the model for certain parameters. I believe there are instances where certain fields may not relate directly to the model in question therefore giving valid reason to break those fields/parameters off from the model.

Upvotes: 0

La-comadreja
La-comadreja

Reputation: 5755

Yes, it would work, strictly speaking.

However, you probably want to use the model. You don't want to create a new variable every time you run the view, which would happen if you use the controller.

Upvotes: 1

Related Questions