Feature #5998

More flexible subpackage directory structure

Added by Robert Lemke over 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
Start date:
2010-01-13
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Currently there is an option to set a @subpackage in a route configuration which will later be translated into a class name by the Request object (see getControllerObjectName()). The pattern for such a class name / object name is hardcoded and reads like this:

F3\@package\@subpackage\Controller\@controllerController

If an application for its own reasons wants to structure controller differently, routes cannot resolve the object name of the controller anymore. For example if a set of controllers dealing with the account of a user need to be collected in one directory, this structure would be nice:

  MyPackage\
     Classes\
        Controller\
           Account\
              RegistrationController.php
              PersonalInfo.php
              CancellationController.php

which would result in the following pattern:

F3\@package\Controller\@subpackage\@controllerController

This is, however, not possible at the moment because the pattern is not configurable and even if so, it would conflict with other packages relying on other patterns. Additionally "sub package" doesn't really fit anymore once we refer to a sub structure below "Controllers".

We could for example allow @controller to contain namespace separators:

   @package: "MyPackage" 
   @controller: "Account\Registration" 
#1

Updated by Robert Lemke over 11 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3606.

Also available in: Atom PDF