Log message #4179880

# At Username Text
# Mar 15th 2019, 14:10 neon1024 `Router::scope('/', function (RouteBuilder $routes) { }`
# Mar 15th 2019, 14:10 neon1024 Yep
# Mar 15th 2019, 14:07 cakephp-slack Do I put my “default” routing in scope(‘/’) and my prefix routing in prefix(‘admin’)?
# Mar 15th 2019, 14:06 neon1024 So when you add an api, you can use the ‘api’ prefix! :)
# Mar 15th 2019, 14:06 neon1024 Yes, use a prefix
# Mar 15th 2019, 14:03 cakephp-slack It’s separation of admin and frontend basically
# Mar 15th 2019, 14:02 cakephp-slack I think I’m trying to use a scope routing for a prefix goal ,:)
# Mar 15th 2019, 14:01 neon1024 Although it sounds a little XY. What is it you’re trying to achieve?
# Mar 15th 2019, 14:00 neon1024 @cakephp-slack I would use a custom routing param for this
# Mar 15th 2019, 13:41 cakephp-slack There has to be a better way right?
# Mar 15th 2019, 13:41 cakephp-slack `$this->request->getParams()` does not exist. `$this->request` has some info, closest info is the `_matchedRoute` but I would have to preg_match it or something to get the info.
# Mar 15th 2019, 13:37 berarma You mean ```debug($this->request)``` or ```debug($this->request->getParams())```
# Mar 15th 2019, 13:10 spriz @cakephp-slack did you try `debug($this->params)` ?
# Mar 15th 2019, 13:07 cakephp-slack CakePHP 3.7 btw
# Mar 15th 2019, 13:06 cakephp-slack When I’m using multiple scopes in my routing, is there a way of knowing which scope I’m in, in the controller?
# Mar 15th 2019, 12:35 berarma @half2me, I meant to use formatResults to load the comments not to filter them.
# Mar 15th 2019, 11:42 edgaras.jan add `group(Comments.article_id)` instead of `limit(1)`
# Mar 15th 2019, 11:10 half2me You definitely want to use SQL to sort out the data not PHP :S
# Mar 15th 2019, 11:10 half2me I'm tinking hundreds of thousands of comments...
# Mar 15th 2019, 11:09 half2me @berarma but that loads the entire dataset into memory
# Mar 15th 2019, 11:09 berarma You could use Query::formatResults
# Mar 15th 2019, 10:55 half2me what is the recommended way to get such an association working? It would be really useful to have this in an association.
# Mar 15th 2019, 10:55 half2me if I get rid of that `LIMIT 1` it works, but I now get multiple authors returned, and I would have to call a `DISTINCT` as well...
# Mar 15th 2019, 10:54 half2me But if I want to do a `get($authorId, ['contain' => ['Articles.LatestComment']])` the generated SQL query only returns 1 latest comment because it applies that `limit 1`
# Mar 15th 2019, 10:53 half2me the problem with that is it works for a single Article
# Mar 15th 2019, 10:53 half2me but because the `join` strategy doesn't work with these, I used the `select` strategy
# Mar 15th 2019, 10:53 half2me the finder did a `$query->orderAsc('posted_date')->limit(1);`
# Mar 15th 2019, 10:52 half2me what I tried doing is making a `latestComment` association, where I specified a custom `finder`
# Mar 15th 2019, 10:51 half2me I want to make a hasOne association on Articles, which always returns the last comment posted for that article
# Mar 15th 2019, 10:51 half2me Suppose you have Authors, Articles, Comments (comments have a posted date)
# Mar 15th 2019, 10:50 half2me @berarma back to my previous question, I'll explain the scenario I have, which could be a pretty common use case, but I'm unsure of the best way to implement it
# Mar 15th 2019, 10:39 dereuromark mixing input from URL params as arguments with this seems like a really bad idea.
# Mar 15th 2019, 10:39 dereuromark I dont like how controller actions are injected here, I would expect only the controller to have the service as attribute.
# Mar 15th 2019, 10:36 dakota if it was done at a cakefest
# Mar 15th 2019, 10:36 dakota vaguely. It should be on the youtube channel
# Mar 15th 2019, 10:36 dakota For users, there is http://github.com/cakedc/users, for mail just use a service like mailgun and for invoicing integrate into something like freshbooks :slightly_smiling_face:
# Mar 15th 2019, 10:36 neon1024 Anyone remember the talk that @lorenzo did about implementing a DI container? I’m certain he used https://github.com/lorenzo/piping-bag
# Mar 15th 2019, 10:34 dakota because buying random scripts always works so well :,)
# Mar 15th 2019, 10:25 acosonic They say it's same thing for them switching from cake 2 -> Cake 3, or cake 2 -> Laravel, I have 2 seniors and 1 medior, medior does not care, but seniors want to give Laravel a try, since they were "testing" cake 3 yesterday and decided to migrate cake 2 code, now they want to just buy laravel scripts and try to merge them into 1 system...
# Mar 15th 2019, 10:23 half2me @acosonic is that the only reason why they want to switch to Laravel?
# Mar 15th 2019, 10:21 narendravaghela @acosonic Same happened with me, my past agency started to adopt Laravel and I left the agency :)