Log message #4141426

# At Username Text
# May 16th 2018, 14:50 alexdd55 is it possible to define a folder like img/ css/ adiditioanlly… need a folder files/ to be handled like those others
# May 16th 2018, 14:49 itmpls save my life on a daily basis
# May 16th 2018, 14:49 itmpls @ndm dude, thank you for all your answers on SO if I haven't already said it
# May 16th 2018, 14:48 alexdd55 whaddap dudes
# May 16th 2018, 14:45 lorenzo if it is annoying we could add code to the behavior to read a query option to disable itself
# May 16th 2018, 14:45 lorenzo translate behavior is not special
# May 16th 2018, 14:45 lorenzo joinWith is always going to attach any logic that the association has
# May 16th 2018, 14:44 lorenzo yes
# May 16th 2018, 14:41 ndm @lorenzo A quick question in case you're not busy... Is it the expected behavior that when using the query builders `*JoinWith()` methods with associations that have the `Translate` behavior attached, this causes the joined association to also be contained, ie the associated records are being queried and included in the results?
# May 16th 2018, 14:39 itmpls and if there isn't an established valid refresh token as well
# May 16th 2018, 14:38 itmpls anyone familiar with refresh token flow? once i create a refresh token for an access token, i'm letting the "claim" last 2 hours. should my client side app try just refreshing it at an X interval if the initial access token has expired?
# May 16th 2018, 14:31 admad the code is correct :slightly_smiling_face:
# May 16th 2018, 14:30 neon1024 Your docblock says 304, but your code is 301 :P
# May 16th 2018, 14:29 neon1024 Thanks! I’ll take a look
# May 16th 2018, 14:29 admad use that instead of core `ErrorHandlerMiddlware`
# May 16th 2018, 14:29 neon1024 No harm in teaching me something.
# May 16th 2018, 14:28 admad @neon1024 i am in a spoon feeding mood :slightly_smiling_face: https://gist.github.com/ADmad/606beddce65495d37d5e0bce1e2a7c04
# May 16th 2018, 14:23 neon1024 It’s all a bit new as we tend to do this in Nginx, but some of the redirects are complicated.
# May 16th 2018, 14:19 neon1024 Cool, well I will try and capture a 404 first, and that will give me an idea of where to start
# May 16th 2018, 14:19 saeideng you have a lot of ways to do it :,)
# May 16th 2018, 14:18 neon1024 Well yeah, that’s what I thought, but couldn’t I overload the `ErrorHandlerMiddleware::handleException` ? I should go and look at Crud and see how it captures those 404s I suppose
# May 16th 2018, 14:17 slackebot ->add($this->redirect()) ; return $middlewareQueue; } public function redirect() { return function($request, $response, $next){ $response = $next($request, $response); if ($response->getStatusCode()==404) { $response = $response->withHeader(' ....redirect ....'); } return $response; }; } ```
# May 16th 2018, 14:17 saeideng ``` public function middleware($middlewareQueue) { $middlewareQueue // Catch any exceptions in the lower layers, // and make an error page/response ->add(ErrorHandlerMiddleware::class) // Handle plugin/theme assets like CakePHP normally does. ->add(AssetMiddleware::class) // Add routing middleware. ->add(new RoutingMiddleware($this))
# May 16th 2018, 14:17 saeideng @neon1024 did not test but
# May 16th 2018, 14:12 neon1024 Sorry, I misunderstood what you meant. I’ll go do some reading! Thanks for the tips
# May 16th 2018, 14:11 admad i already told you to use custom error handler middleware instead :slightly_smiling_face:
# May 16th 2018, 14:10 saeideng you should use response
# May 16th 2018, 14:10 admad having it as first would be unnecessary overhead for every request which does not need rediecting
# May 16th 2018, 14:10 Diego_ the associated save() has worked fine with the creation form
# May 16th 2018, 14:09 neon1024 @admad Oh? I was thinking of having it as the first middleware in the stack, which interrogated the incoming request, changed the url and sent it off down the middleware queue, right?
# May 16th 2018, 14:08 admad @neon1024 new response not request :slightly_smiling_face:
# May 16th 2018, 14:08 Diego_ hello, i'm trying to figure out why save() associated is not working, using cake 3.6 version. When i save the entity only the main one is saved, the entity debug shows the correct data for the main and the associated entity with de data marked as dirty and the modified values but the associated one is not saved: https://pastebin.com/VvpCTVLM
# May 16th 2018, 14:08 neon1024 Well, I’ll get it setup and try!
# May 16th 2018, 14:07 neon1024 @admad I just return a new Request with the new url?
# May 16th 2018, 14:07 neon1024 Good idea @admad I think I migrate my redirects into a proper middleware, then I can unit test it too, which is probably a good idea.
# May 16th 2018, 14:03 admad maintain a map of old => new urls and if found return a new `RedirectResponse` instance from `handleException()`
# May 16th 2018, 14:02 neon1024 Even with scope and some clever regex that could get fiddly
# May 16th 2018, 14:02 neon1024 Well I’d rather not slow down my routing by having it parse all the redirects first
# May 16th 2018, 14:02 saeideng `Router::redirect()`
# May 16th 2018, 14:01 neon1024 Beats having to send a pull request to our Ansible config repo!
# May 16th 2018, 14:01 admad to handle redirects for old urls