# |
Feb 17th 2020, 22:25 |
k4t |
well it will work, but to build correct parameters I will have to add a bit more logic to the code and I wanted to avoid that |
# |
Feb 17th 2020, 22:23 |
k4t |
I think that soething is wrong when request contain passed parameters (in my example this is slug) |
# |
Feb 17th 2020, 22:23 |
challgren |
Ok since you used a _name what about using that in the link? |
# |
Feb 17th 2020, 22:22 |
k4t |
but generally u r right, I should add logic for "false" |
# |
Feb 17th 2020, 22:21 |
k4t |
url is still generated wrong |
# |
Feb 17th 2020, 22:21 |
k4t |
and I think this is not the problem here, as when I remove my custom Route class from routes |
# |
Feb 17th 2020, 22:21 |
k4t |
with one exception - it will add '/' at the end |
# |
Feb 17th 2020, 22:21 |
k4t |
my route should do exactly what CakePhP DashedRoute is doing |
# |
Feb 17th 2020, 22:18 |
ndm |
@k4t You do not account for non-matching URLs, `parent::match()` can return `false` |
# |
Feb 17th 2020, 22:17 |
k4t |
looks like I have to build urls manually ;/ |
# |
Feb 17th 2020, 22:16 |
ndm |
Well, I don't know what to say about that, I'd have to dig up the discussion in Github. Looking at how `Router::parseRequest()` and `Router::reverseToArray()` return the query arguments in `?`, I'm not sure if I should trust the docs. |
# |
Feb 17th 2020, 22:11 |
challgren |
@ndm “Router will also convert any unknown parameters in a routing array to querystring parameters. The ? is offered for backwards compatibility with older versions of CakePHP.” |
# |
Feb 17th 2020, 22:10 |
k4t |
oO |
# |
Feb 17th 2020, 22:10 |
k4t |
when I remove customer route class and I am on page "/meine-ausgaben/abcd" then HTMLHelper will give me "/my-editions/view?t=test" |
# |
Feb 17th 2020, 22:05 |
k4t |
here u can see how routes r defined |
# |
Feb 17th 2020, 22:05 |
k4t |
https://gist.github.com/K4T/b8f34b86138d2149e25329e6427b93eb |
# |
Feb 17th 2020, 22:03 |
challgren |
Like @ndm said it might be your route connection |
# |
Feb 17th 2020, 22:03 |
k4t |
that is what I wanted to ommit |
# |
Feb 17th 2020, 22:02 |
challgren |
You might need to specify your action then |
# |
Feb 17th 2020, 22:02 |
k4t |
@challgren both gave the same results |
# |
Feb 17th 2020, 22:01 |
challgren |
4.x docs have `echo $this->Html->link(‘View image’, [ ‘controller’ => ‘Images’, ‘action’ => ‘view’, 1, ‘?’ => [‘height’ => 400, ‘width’ => 500] ]);` |
# |
Feb 17th 2020, 22:01 |
ndm |
I'm not really sure, I just vaguely remember the back and forth about |
# |
Feb 17th 2020, 22:00 |
challgren |
Ohh it might be |
# |
Feb 17th 2020, 22:00 |
ndm |
I thought that was deprecated that in favor of explicitly using `?`? |
# |
Feb 17th 2020, 21:57 |
challgren |
@k4t it should be <?= $this->Html->link(‘E-Paper’, [‘t’ => ‘test’]); ?> |
# |
Feb 17th 2020, 21:56 |
ndm |
What's the connected route for that? |
# |
Feb 17th 2020, 21:55 |
k4t |
:S |
# |
Feb 17th 2020, 21:55 |
k4t |
it is a bit funny thing because when I am on "/meine-ausgaben" it will generate "/meine-ausgaben?t=test" but when I am on: "/meine-ausgaben/abc" it will generate "/" |
# |
Feb 17th 2020, 21:54 |
ndm |
Generally that should work I think. |
# |
Feb 17th 2020, 21:52 |
k4t |
<?= $this->Html->link('E-Paper', ['?' => ['t' => 'test']]); ?> this gives me "/" even if I am not on the "/" page |
# |
Feb 17th 2020, 21:51 |
k4t |
@ndm do you have idea how I can append query string to current url in the view with HTML helper? |
# |
Feb 17th 2020, 21:45 |
ndm |
you're welcome |
# |
Feb 17th 2020, 21:44 |
k4t |
thats true |
# |
Feb 17th 2020, 21:43 |
FunkadelicRelic |
Also - gotta say, slightly off topic but this is the most helpful forum/community I think I've ever used. I really appreciate your help. Thank you. |
# |
Feb 17th 2020, 21:42 |
FunkadelicRelic |
Cool, thanks @ndm - I'll look into the beforeMarshal callback - I used that previously for something else so figured it might be the way to go. |
# |
Feb 17th 2020, 21:41 |
slackebot |
selected `recommendationgroups` to fetch the primary keys of the related `recommendations`, and inject them into the data accordingly, which could for example be done in the `beforeMarshal` callback/handler. |
# |
Feb 17th 2020, 21:41 |
ndm |
@FunkadelicRelic For starters that's not something that the ORM can do automatically, as it could with saving an `assessment` with multiple `recommendations`. You'd need to hook into somewhere to do the "conversion" from `recommendationgroups` to `recommendations`. You could do something like fetching a list of selectable groups in your controller, create a form control for them, and when receiving the form data on the server side, use the |
# |
Feb 17th 2020, 21:38 |
k4t |
but this does not work for all routes |
# |
Feb 17th 2020, 21:37 |
k4t |
by using HTMLHelper link method how I can add query string params to current url? Here is what I tried: <?= $this->Html->link('E-Paper', ['?' => ['t' => 'test']]); ?> |
# |
Feb 17th 2020, 21:34 |
k4t |
hello |
# |
Feb 17th 2020, 21:33 |
FunkadelicRelic |
Any ideas where I should start? |