[Flow] Create Link outside of controller

Christian Loock chl at vkf-renzel.de
Wed Apr 9 13:08:24 CEST 2014


Hi,

see my answers in the Quote below


On 09.04.2014 12:55, Bastian Waidelich wrote:
> 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.
>
See, and that is why i didnt intend to safe them as whole URLs but as 
Route Arguments, like Action, Controller, Package and the arguments.

>>
>> 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.
>
I am well aware of that. I think I will keep my apporache to not break 
links and use your technique you described before. I was to some extend 
clear to me, that I had to create an own Request object to use the 
UriBuilder. I was hoping to find a way that feels less overhead heavy 
than this one, since I really dont need a current request. Somewhat like 
a lightweight URI Builder, where you can just input everything you need 
to create a URI would be need, maybe as a Utility Class. This wouldn't 
really affect the way you usually would generate links via ViewHelpers 
and stuff, but might be usefull to other Use Cases like the one I have 
or maybe inside a CommandController, where you probably don't have a 
HTTP Request either, I imagine?

>> However, the tip is really appreciated, as it might become handy in the
>> future :)
>
> I'm glad to read that ;)
>


Well not if I store the whole URL, but since I stored only the URI 
Parameters like action etc. I needed it.


On 09.04.2014 12:57, Bastian Waidelich wrote:
> Bastian Waidelich wrote:
>
> Damn, do you also see "Undisclosed recipients" as sender of my posts?
>
>
Nope, you are Bastian Waidelich for me :D

Thanks again for your quick response. Even though I love flow, simple 
things like this can be really hard to figure out own your from time to 
time.

Cheers

-- 
Christian Loock
Web Developer
Renzel Agentur
www.renzel-agentur.de



More information about the Flow mailing list