Log message #4179889

# At Username Text
# Mar 15th, 15:02 gareth.ellis if I run a single test which hits the database, when the `Mysql::__destruct()` gets called at the end of the test run, it tries to write to the model method cache, and I get a bunch of warnings/errors
# Mar 15th, 15:02 gareth.ellis this is a long-shot, but has anyone had any problems with `FileEngine` cache on cake 2.10 and php 7.2?
# Mar 15th, 14:45 ricksaccous or should i drop the belongsTo and relate it differently based on modified conditions or something
# Mar 15th, 14:45 ricksaccous would this even make sense
# Mar 15th, 14:45 ricksaccous but i also want it to belongto the latest record of the model it has many of
# Mar 15th, 14:44 ricksaccous so i have a model that has many of another model
# Mar 15th, 14:14 cakephp-slack Nice! Thnx for the info!
# Mar 15th, 14:10 neon1024 You can nest prefixes too which is a super handy feature I think 8)
# Mar 15th, 14:10 neon1024 `Router::prefix('admin', function (RouteBuilder $routes) {`
# Mar 15th, 14:10 neon1024 `Router::scope('/', function (RouteBuilder $routes) { }`
# Mar 15th, 14:10 neon1024 Yep
# Mar 15th, 14:07 cakephp-slack Do I put my “default” routing in scope(‘/’) and my prefix routing in prefix(‘admin’)?
# Mar 15th, 14:06 neon1024 So when you add an api, you can use the ‘api’ prefix! :)
# Mar 15th, 14:06 neon1024 Yes, use a prefix
# Mar 15th, 14:03 cakephp-slack It’s separation of admin and frontend basically
# Mar 15th, 14:02 cakephp-slack I think I’m trying to use a scope routing for a prefix goal ,:)
# Mar 15th, 14:01 neon1024 Although it sounds a little XY. What is it you’re trying to achieve?
# Mar 15th, 14:00 neon1024 @cakephp-slack I would use a custom routing param for this
# Mar 15th, 13:41 cakephp-slack There has to be a better way right?
# Mar 15th, 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, 13:37 berarma You mean ```debug($this->request)``` or ```debug($this->request->getParams())```
# Mar 15th, 13:10 spriz @cakephp-slack did you try `debug($this->params)` ?
# Mar 15th, 13:07 cakephp-slack CakePHP 3.7 btw
# Mar 15th, 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, 12:35 berarma @half2me, I meant to use formatResults to load the comments not to filter them.
# Mar 15th, 11:42 edgaras.jan add `group(Comments.article_id)` instead of `limit(1)`
# Mar 15th, 11:10 half2me You definitely want to use SQL to sort out the data not PHP :S
# Mar 15th, 11:10 half2me I'm tinking hundreds of thousands of comments...
# Mar 15th, 11:09 half2me @berarma but that loads the entire dataset into memory
# Mar 15th, 11:09 berarma You could use Query::formatResults
# Mar 15th, 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, 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, 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, 10:53 half2me the problem with that is it works for a single Article
# Mar 15th, 10:53 half2me but because the `join` strategy doesn't work with these, I used the `select` strategy
# Mar 15th, 10:53 half2me the finder did a `$query->orderAsc('posted_date')->limit(1);`
# Mar 15th, 10:52 half2me what I tried doing is making a `latestComment` association, where I specified a custom `finder`
# Mar 15th, 10:51 half2me I want to make a hasOne association on Articles, which always returns the last comment posted for that article
# Mar 15th, 10:51 half2me Suppose you have Authors, Articles, Comments (comments have a posted date)
# Mar 15th, 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, 10:39 dereuromark mixing input from URL params as arguments with this seems like a really bad idea.