Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:10:57+00:00 2026-06-02T01:10:57+00:00

I’ve found myself with a need to move some functionality into the service layer.

  • 0

I’ve found myself with a need to move some functionality into the service layer. In this particular case, it relates to an example regarding zend-paginator.

In the example, the service layer is simply an interim stage between the controller and the model. It seems that this is it’s intended role, and under certain circumstances it seems to make good sense.

It raises a few questions for me though.

Firstly, could I not just as easily move the example service code to the controller without any real penalty, and would this not benefit me by removing a layer of code?

Assuming there is a tangible benefit in moving the code to the service layer, what then happens to the rest of my mapper interaction? Does the controller access the service layer for some tasks and the mapper for others, or does the service layer then become a proxy to all mapper interaction?

It seems like for things such as creating a new row from a form, the service layer does not add any value, so it would literally amount to a pass through function at service layer level.

Using it for some tasks seems like it will complicate things later, while using it as a proxy seems like we’re purposely introducing code replication and complexity.

Any clarification on ‘best practice’ would be very helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:10:58+00:00Added an answer on June 2, 2026 at 1:10 am

    Moving the code to the controller results in a fat controller. It tightly couples the application with the UI. It makes it hard to perform that action in a different context. A skinny controller handles requests in a specific context by using one or more services to generate a response.

    These services define the boundary of the application (domain logic) by interacting with the models in a loosely coupled way that can be integrated into different contexts.

    For example, a controller interacts with the service layer in an MVC app. A console wrapper can interact the service layer on the cli. A SOAP or JSON-RPC server can use reflection to expose a service as a webservice API. All of this can be done without duplicating the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.