Log message #4200112

# At Username Text
# Aug 28th 2019, 09:16 val I think there is performance problem in that `deleteMany`. It seems to execute many SQL statements instead of one like in `deleteAll`.
# Aug 28th 2019, 09:14 dereuromark And I recommend to always use the *ManyOrFail() ones to avoid silent failures.
# Aug 28th 2019, 09:14 dereuromark You could backport this deleteMany() into your code until 3.9 lands.
# Aug 28th 2019, 09:14 val 'dependent' is already set to `true` in the association
# Aug 28th 2019, 09:14 neon1024 To me `deleteAll()` with dependent could be very dangerous
# Aug 28th 2019, 09:13 neon1024 Probably need to call `delete()` with `dependent` set in the association
# Aug 28th 2019, 09:12 dereuromark ah sry, that is available only in 3.9 and 4.0 ( https://github.com/cakephp/cakephp/blob/3.next/src/ORM/Table.php#L2388 ), I am thinking already too far ahead.
# Aug 28th 2019, 09:09 val I meant `Table::deleteAll()`. There is no`deleteMany()` in Table class.
# Aug 28th 2019, 09:08 dereuromark update"All"() are atomic (no callbacks)
# Aug 28th 2019, 09:08 dereuromark the Many are supposed to be the ones non atomic afaik
# Aug 28th 2019, 09:07 dereuromark isnt there deleteMany()?
# Aug 28th 2019, 09:06 val Hi, is it intended that `deleteAll()` in 3.x does not delete dependent records like in 2.x?
# Aug 28th 2019, 09:05 development Ok, thanks @dereuromark!
# Aug 28th 2019, 09:04 dereuromark you can remove it, sniffers would do that for you as well. same namespace doesnt need it.
# Aug 28th 2019, 08:58 development When I bake a new controller, it adds this to the top of my file: namespace App\Controller; use App\Controller\AppController; PhpStorm tells me the 'use' is unused. Is this some kind of double declaration and if so, can someone tell me why bake adds both of them and if I can remove it since PhpStorm says it is unused?
# Aug 28th 2019, 08:10 neon1024 Morning everyone :wave:
# Aug 28th 2019, 08:03 ndm PHP sucks at serving files either way, as the process has to run the whole time.
# Aug 28th 2019, 07:29 spriz but we also mostly handle batches of ~2-3 mb JPEGs and rather large dat/csv/txt files (50-100mb)
# Aug 28th 2019, 07:28 spriz I see - I thought actually streams always would more or less outperform strings in memory
# Aug 28th 2019, 07:27 spriz but that might be more of a PHP thing than a Cake thing anyway :slightly_smiling_face:
# Aug 28th 2019, 07:27 admad unless your file is very large not using streaming is more efficient i believe
# Aug 28th 2019, 07:26 spriz or `stream_get_contents()` for the matter
# Aug 28th 2019, 07:26 spriz I'm just thinking of poor newcomers to which the whole `stream` thing might be new. I see a lot of `file_get_contents` around still
# Aug 28th 2019, 07:25 spriz True, that's perfect for me as well :)
# Aug 28th 2019, 07:25 admad `$response->withBody(new Stream($fileStream))` is easy enough
# Aug 28th 2019, 07:24 spriz I guess there is some overhead of converting a `resource` to `StreamInterface` so it would be better if one could keep things in `StreamInterface` from the start - maybe that's the reasoning?
# Aug 28th 2019, 07:23 spriz Oh yeah, I remember expecting that initially
# Aug 28th 2019, 07:22 admad `withBody()` could have had a wider argument type which converted a resource instance into StreamInterface instance :P
# Aug 28th 2019, 07:19 spriz so I'll forgive you on that one ;P
# Aug 28th 2019, 07:19 spriz I was looking for `withStream` by reflex anyway :)
# Aug 28th 2019, 07:19 admad i had a n00b moment, Response doesn't have any `set*` method (expect deprecated ones maybe)
# Aug 28th 2019, 07:18 spriz grrrrrrrrreat
# Aug 28th 2019, 07:18 spriz No worries, this is much better! And it also keeps memory usage down
# Aug 28th 2019, 07:17 admad sorry, no such method :P
# Aug 28th 2019, 07:17 spriz or did I misunderstand?
# Aug 28th 2019, 07:17 spriz I don't see such method @admad: https://api.cakephp.org/3.8/class-Cake.Http.Response.html
# Aug 28th 2019, 07:16 admad or maybe just `$response->setStream($fileStream)` might work
# Aug 28th 2019, 07:16 spriz Thanks a lot, that has been bugging me... Facepalm ,:)
# Aug 28th 2019, 07:15 spriz Works @admad!
# Aug 28th 2019, 07:15 spriz will try right awya
# Aug 28th 2019, 07:15 spriz Aha! Of course