Defining routes and controllers relationship for given pages I'm building a CMS app with the help of a custom framework. The back-office is composed of the following pages:


post list
page list
user list
post edit
page edit
user edit


Actually, my routes are defined as follows (I don't put regex here for clarity sake):

return array(
    '/post-list/' =&gt; array(
        'controller' =&gt; 'PostListController',
        'action'     =&gt; 'view'
    ),
    '/page-list/' =&gt; array(
        'controller' =&gt; 'PageListController',
        'action'     =&gt; 'view'
    ),
    '/user-list/' =&gt; array(
        'controller' =&gt; 'UserListController',
        'action'     =&gt; 'view'
    ),
    '/post-edit/(params)' =&gt; array(
        'controller' =&gt; 'PostEditController',
        'action'     =&gt; 'view'
    ),
    '/page-edit/(params)' =&gt; array(
        'controller' =&gt; 'PageEditController',
        'action'     =&gt; 'view'
    ),
    '/user-edit/(params)' =&gt; array(
        'controller' =&gt; 'UserEditController',
        'action'     =&gt; 'view'
    ),
);


With this approach, there are many little controllers that share almost the same lines of code (not DRY code). For example:

PostListController:

public function view()
{
    $postMapper = $this-&gt;repository-&gt;getMapper('PostMapper');
    $postSlugs  = $postMapper-&gt;fetchPostSlugs();
    $posts = array();

    foreach ($postSlugs as $postSlug) {
        $posts[] = $this-&gt;repository-&gt;getModel('PostModel', $postSlug);
    }

    if ($view = $this-&gt;repository-&gt;getView('PostListView')) {
        $models = array('posts' =&gt; $posts);
        $body   = $view-&gt;render($models);

        $this-&gt;response-&gt;setBody($body);
        $this-&gt;response-&gt;send();

        return;
    }
    // ...404 handling
}


... will be nearly identical to the PageListController, the only things that change are View and Model class names.

What would be the MVC best practice or which make more sense?


Keeping this approach: 1 controller for 1 page?
Making a controller that handles Lists having for action: posts(), pages(), users() and a controller handling Edit the same way?
Making a controller handling Post having for actions: edit() and list(), same for Page and User? (note that in this case I might still have some "unDRY" code).
Something else..?
I asked myself today again the same question for my current project where I have to implement a bunch of entities that will need their own controllers implementing usual actions such as:


show()
list()
edit()
save()
delete()
etc...


I believe we can extract from each of these actions a logic/control flow pattern common to all entities.

Thus, an abstract EntityController implementing these actions seems to me the way to go... Of course we can inject in child controllers extending EntityController specific parameters and services.