Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't see too much business logic in your actions. Generally your controllers/actions role is to be a gateway for your domain model and services, and handle protocol specific stuff. CLI commands deals with command line arguments, controllers with HTTP requests, so your action methods do what they supposed to.</p> <p>You have a lot of options to refactor your code to eliminate these kind of duplicate codes in your controller actions using some refactoring patterns. <a href="http://martinfowler.com/refactoring/catalog/extractMethod.html" rel="nofollow">Extract method</a> to move these lines into a protected method of your controller. You can <a href="http://martinfowler.com/refactoring/catalog/extractSuperclass.html" rel="nofollow">extract a base class</a> for these similar controllers and move the methods there. </p> <p>In more complicated scenarios you can move controller logic (extracting domain specific information from the HTTP request) into services, especially if you need some other DIC managed services to complete this task. There is nothing wrong accessing the request object in these services. You can make this kind of services request scoped, or implement ContainerAware and get the request from the container.</p> <pre class="lang-xml prettyprint-override"><code>&lt;service id="controller-helper-service" class="%helper.class%" scope="request"&gt; &lt;argument type="service" id="request" /&gt; &lt;argument type="service" id="some-other-service" /&gt; &lt;/service&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload