Feature #5998

More flexible subpackage directory structure

Added by Robert Lemke almost 10 years ago. Updated about 9 years ago.

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

100%

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" 

Associated revisions

Revision bc5c763a (diff)
Added by Robert Lemke almost 10 years ago

[+FEATURE] FLOW3 (MVC): If the result of an action method is an object providing a __toString() method, this method will be called by the ActionController and its result will be added to the response content. Resolves #5995
[+FEATURE] FLOW3 (MVC): The routes property @controller now allows the use of namespace separators for referring to classes in file / class structure below "Controllers". Resolves #5998
[~TASK] FLOW3 (Documentation): Fixed a few typos in the AOP documentation.

History

#1 Updated by Robert Lemke almost 10 years ago

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

Applied in changeset r3606.

Also available in: Atom PDF