Feature #29258

Provide a way to override classes by environment

Added by Fernando Arconada about 10 years ago. Updated over 9 years ago.

Needs Feedback
Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


In FLOW3 you can define several environments in your configuration. But, how could you override a class (ie. a controller) depending of the environment?.

If you always can clone your server you dont need environments, even in configuration.

I'm thinking in something like


The class is only overrided if it is defined for this environment
Cause the feature could decrease the performance of the framework it could be enabled/disabled by a config option


Updated by Karsten Dambekalns about 10 years ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow

Updated by Christopher Hlubek about 10 years ago

I would recommend to use configuration settings for that (which can be context dependent). If this is not enough, the Objects.yaml can override interfaces but not concrete classes per context (without performance losses).


Updated by Fernando Arconada about 10 years ago

As yu said Objects.yaml only override interfaces,
For example you are doing A/B testing and for example you need to have an additional variable in your view. how to do that? conditions inside the action? It doesnt looks very clean. It is easy with template views, for example:
protected function initializeView(\TYPO3\FLOW3\MVC\View\ViewInterface $view) {
/** * @var TYPO3\FLOW3\MVC\Web\Request
$requestArguments = $this->controllerContext->getRequest()->getArguments();
if(isset($requestArguments['bversion']) && $requestArguments['bversion']=='1' && $view instanceof \TYPO3\Fluid\View\TemplateView ) {
$packageName = $this->controllerContext->getRequest()->getControllerPackageKey();


but this is only at initializeView, such kind of conditions in every action....


Updated by Christian Müller over 9 years ago

  • Status changed from New to Needs Feedback
  • Has patch set to No

I don't really see the need for this. Debugging on a live machine is bad all the time. Maybe we could introduce a context condition viewhelper so you can change output by context...


Updated by Fernando Arconada over 9 years ago

not only debugging, maybe you need to introduce a new feature in a live system (you could change the environment in a dynamic way with apache). Some changes need to be aproved in staging before going production.... continuous deployment in life system is better with this feature, for example yahoo use to do it using a lot of conditionals but could be more clean with environments

Also available in: Atom PDF