<p>Well, it looks like Sprout Forms itself prefers separate services for everything (they'd be some big services if they weren't,) but Craft does bundle closely-related things together sometimes - <code>FieldsService</code> deals with both fields and groups, <code>TagsService</code> with both tags and tag groups for example.</p>

<p>Personally I just look at how much code there is, if I start getting lost/sick of scrolling and there's more than one 'thing' I'm dealing with, or if the existing service is already pretty big, then I break it out into separate services.</p>

CC BY-SA 3.0
2014-11-25T21:35:46.463Z
2014-11-25T21:35:46.463Z
Mike Pepper
<p>I hope this is the right place to post this, it's more a question on MVC for plugin development.</p>

<p>I'm developing a plugin to extend SproutForms to add users to Campaign Monitor lists. So far I've got the interface where the user can submit their API key and List ID. I then use these to pull in information about the list and add it to the db in <code>pluginname_forms</code>.</p>

<p>Now, I also want to pull in the custom fields for that list and store them in the <code>pluginname_formFields</code> table. </p>

<p>From an MVC point of view, should I keep this in the service that deals with the list data or create a new service which deals with the custom fields data?  </p>

<database><controller><models><services>
MVC - Should these be seperate controllers/models etc
# MVC - Should these be seperate controllers/models etc

(Asked by: username_0 on 2014-11-24)

I hope this is the right place to post this, it's more a question on MVC for plugin development.

I'm developing a plugin to extend SproutForms to add users to Campaign Monitor lists. So far I've got the interface where the user can submit their API key and List ID. I then use these to pull in information about the list and add it to the db in `pluginname_forms`.

Now, I also want to pull in the custom fields for that list and store them in the `pluginname_formFields` table.

From an MVC point of view, should I keep this in the service that deals with the list data or create a new service which deals with the custom fields data?

**Tags:** database, controller, models, services

---

## 1 answers

### Answer by username_1 on 2014-11-25. Score: 3

Well, it looks like Sprout Forms itself prefers separate services for everything (they'd be some big services if they weren't,) but Craft does bundle closely-related things together sometimes - `FieldsService` deals with both fields and groups, `TagsService` with both tags and tag groups for example.

Personally I just look at how much code there is, if I start getting lost/sick of scrolling and there's more than one 'thing' I'm dealing with, or if the existing service is already pretty big, then I break it out into separate services.


---

