[TYPO3-dev] The extbase dilemma

Bastian Waidelich bastian at typo3.org
Thu May 26 12:20:09 CEST 2011


Daniel Brün wrote:

Hi Daniel,

> We applied a (dirty) fix to accelerate this process by caching
> links (sounds simple, but is not in fluid).

Actually it's just a couple of lines of code if you use Dependency 
Injection as described in the wiki [1]:

in Classes/MVC/Web/Routing/UriBuilder.php:

<?php
class Tx_MyExtension_MVC_Web_Routing_UriBuilder extends 
Tx_Extbase_MVC_Web_Routing_UriBuilder {

	protected $firstLevelCache = array();

	public function uriFor($actionName = NULL, $controllerArguments = 
array(), $controllerName = NULL, $extensionName = NULL, $pluginName = 
NULL) {
		$cacheHash = 'foo'; // create unique hash based on given settings & 
parameters
		if (!isset($this->firstLevelCache[$cacheHash])) {
			$this->firstLevelCache[$cacheHash] = parent::uriFor($actionName, 
$controllerArguments, $controllerName, $extensionName, $pluginName);
		}
		return $this->firstLevelCache[$cacheHash];
	}
}
?>


In ext_typoscript_setup.txt:

config.tx_extbase.objects {
	Tx_Extbase_MVC_Web_Routing_UriBuilder {
		className = Tx_MyExtension_MVC_Web_Routing_UriBuilder
	}
}






If you have a good working solution, feel free to share it so we might 
add this feature to the core of Extbase (or maybe better to the TYPO3 core).


> Create a new extension (Peters suggestion: nextbase). This extension would
> be the current FLOW3 with doctrine plus wrapper code to make it work with
> TYPO3 [...]

This was actually Jochens first approach when he wrote "thebridge" [2] 
about two years ago. See [3] for the reason why this couldn't work out 
as official way to support the transition.

Best,
Bastian


[1] 
<http://forge.typo3.org/projects/typo3v4-mvc/wiki/Dependency_Injection_%28DI%29>

[2] http://forge.typo3.org/projects/show/extension-thebridge

[3] 
<http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2011-February/008539.html>




More information about the TYPO3-dev mailing list