[TYPO3-mvc] URIBuilder rewrite

Robert Lemke robert at typo3.org
Wed Aug 12 09:28:47 CEST 2009


Moin Bastian,

Am 11.08.2009 um 17:08 schrieb Bastian Waidelich:

To create general links, you'd have
>
> $uriBuilder
> 	->setTargetPageUid(123)
> 	->setArguments(array('tt_news' => array('article' => 321))
> 	->render()

looks fine (the rest as well), just one thought: as Steffen already  
stumbled upon,
there's a little weirdness concerning that uriBuilder would be  
prototype or singleton.

In general I would assume that a builder is singleton and that the  
build method is
called build() and not render.

On the other hand I would also assume that build methods are stateless  
and behave the
same every time I would call them - which is of course not the case  
because the builder
always still contains the options from previous runs.

So, we can

   1) ignore this bad feeling, make the UriBuilder a singleton and  
provide your proposed
      setters
   2) make UriBuilder a prototype to avoid unintended misconfiguration  
and accept the overhead
      of creating a new instance everytime we create a link (sounds  
slow huh?)
   3) make UriBuilder a singleton and a) provide a kind of reset  
method or b) even let the builder reset
      all options automatically after calling build()
   4) ...

Maybe 3b)?

robert



More information about the TYPO3-project-typo3v4mvc mailing list