[Flow] Create Link outside of controller

Bastian Waidelich bastian at typo3.org
Wed Apr 9 12:55:31 CEST 2014


Christian Loock wrote:

Hi Christian,

> I'm actually inside a model and want to generate a link with data that
> is stored inside the model.

I don't know exactly what your domain is of course, but:
If you really want to store hard-coded URLs in your model, you're 
probably better of creating them from the "outside", for example by 
expecting the URL as constructor argument.

>
> Imagine a edit history that stores pages a user has called. I am
> curently storing action, controller etc. seperatly, but figured out,
> that it would be much easier just to store the whole URL instead.

If you just store the current URL there's no need to use an UriBuilder, 
is there?

But be aware that those links will be broken if your routes change.. I 
think your previous approach of storing the route-values separately is 
actually less error prone.

> However, the tip is really appreciated, as it might become handy in the
> future :)

I'm glad to read that ;)


-- 
Bastian Waidelich


More information about the Flow mailing list