Logs for #cakephp

Page 5 of 36,101, showing 100 records out of 3,610,061 total, starting on record 401, ending on 500

# At Username Text
# Apr 18th, 20:57 admad you can
# Apr 18th, 20:34 maymeow Can I use fixture from vendor plugin or I have to extend it in my tests?
# Apr 18th, 17:52 devito in cake 2 is there a databaseengine for caching?
# Apr 18th, 17:52 ricksaccous which is lengthy for many records*
# Apr 18th, 17:52 ricksaccous which may be lengthy
# Apr 18th, 17:52 ricksaccous saveMany will always expect hydrated entities in
# Apr 18th, 17:51 ricksaccous raw queries always best option
# Apr 18th, 17:51 pedrorocha As curiosity, if I were using the most recent version of cakephp, should I do it with saveMany() or raw queries is still my best option?
# Apr 18th, 17:48 pedrorocha Inner loop memory usage run: 1 -> 2.89 MB Inner loop memory usage run: 2 -> 37.19 MB Inner loop memory usage run: 3 -> 37.61 MB Inner loop memory usage run: 4 -> 38.04 MB Total loop memory usage -> 31.85 MB Awesome! Thank you guys
# Apr 18th, 17:37 pedrorocha Thank you!
# Apr 18th, 17:36 ricksaccous what*
# Apr 18th, 17:36 ricksaccous ....
# Apr 18th, 17:36 ricksaccous i think that he linked up there is sufficient
# Apr 18th, 17:35 pedrorocha Just to be sure $db = ConnectionManager::getDataSource('default'); $db->rawQuery("INSERT ...."); is what I should be using in case of many records?
# Apr 18th, 17:34 ricksaccous thanks
# Apr 18th, 17:33 ricksaccous interesting, i'll consider this if i run into bottlenecks
# Apr 18th, 17:33 admad update or insert depending on what you need
# Apr 18th, 17:33 admad use what i linked above
# Apr 18th, 17:32 ricksaccous @admad speaking of i have a point where i might be patching in 400 records.... do you recommend saving that instead with raw sql if possible?
# Apr 18th, 17:31 admad https://book.cakephp.org/3.0/en/orm/query-builder.html#inserting-data
# Apr 18th, 17:31 ricksaccous yeah ;)
# Apr 18th, 17:31 ricksaccous using the ORM to just build the raw save query
# Apr 18th, 17:31 pedrorocha Unfortunately I'm using cakephp 3.1 and I'm afraid I can upgrade it in production.. Can it be done in cakephp 3.1?
# Apr 18th, 17:31 ricksaccous and probably skipping to raw sql saves is faster
# Apr 18th, 17:30 ricksaccous i'd just be worried about the patchEntities anyway
# Apr 18th, 17:30 admad ORM methods are meant for bulk saves anyway. Use lower level db methods
# Apr 18th, 17:30 ricksaccous no you'd have to do a saveMany
# Apr 18th, 17:30 pedrorocha ->save() accepts my whole array of data?
# Apr 18th, 17:29 ricksaccous in one query
# Apr 18th, 17:29 ricksaccous @pedrorocha why not save 15k per loop pass
# Apr 18th, 17:27 slackebot loop memory usage run: 10 -> 2.69 MB Inner loop memory usage run: 11 -> 2.69 MB Inner loop memory usage run: 12 -> 2.48 MB Total loop memory usage -> 2.41 MB Why is this happening? How can I free the memory used by the inner loop on each run?
# Apr 18th, 17:27 slackebot $this->UserNotification->patchEntity($userNotification, $dataToSave); $this->UserNotification->save($userNotification); }``` It's wrapped around a while loop counting the number of runs and managing the batches. When I run this code and track the memory usage of it, this is what I'm getting: Inner loop memory usage run: 1 -> 2.61 MB Inner loop memory usage run: 2 -> 9.43 MB Inner loop memory usage run: 3 -> 16.23 MB Inner loop memory usage run: 4
# Apr 18th, 17:27 pedrorocha Hello guys, I'm trying to save 320k records on my db using a foreach loop to iterate through an array of data. I loaded the model outside the loop and split the data in batches of 15k, the inner loop looks like this: ```foreach ($users as $user) { $dataToSave = array('user_id' => $user->id, 'notification_id' => $notificationId); $userNotification = $this->UserNotification->newEntity(); $userNotification =
# Apr 18th, 17:27 slackebot -> 23.52 MB Inner loop memory usage run: 5 -> 29.82 MB Inner loop memory usage run: 6 -> 38.11 MB Inner loop memory usage run: 7 -> 44.41 MB Inner loop memory usage run: 8 -> 50.7 MB Inner loop memory usage run: 9 -> 56.99 MB Inner loop memory usage run: 10 -> 67.29 MB Inner loop memory usage run: 11 -> 73.58 MB Inner loop memory usage run: 12 -> 79.67 MB Total loop memory usage -> 82.13 MB It should not be wasting this much memory on each loop, when
# Apr 18th, 17:27 slackebot I comment the `->save()` line, it looks like this (as it should be): Inner loop memory usage run: 1 -> 2.66 MB Inner loop memory usage run: 2 -> 2.68 MB Inner loop memory usage run: 3 -> 2.69 MB Inner loop memory usage run: 4 -> 2.69 MB Inner loop memory usage run: 5 -> 2.69 MB Inner loop memory usage run: 6 -> 2.69 MB Inner loop memory usage run: 7 -> 2.69 MB Inner loop memory usage run: 8 -> 2.69 MB Inner loop memory usage run: 9 -> 2.69 MB Inner
# Apr 18th, 16:32 admad @mrfeedback `<?=` is short echo, different than short open tag. It's unaffected by php config and always available
# Apr 18th, 16:20 mrfeedback `Note that this directive does not control the <?= shorthand tag, which can be ; used regardless of this directive.`
# Apr 18th, 16:20 mrfeedback oh. okay forget what i said
# Apr 18th, 16:18 mrfeedback yep i mean `<?=` as `short_tag_open` is also not recommened as `On` for production environments according to the official php.ini https://github.com/php/php-src/blob/master/php.ini-production
# Apr 18th, 16:14 ricksaccous the second is never used
# Apr 18th, 16:13 ricksaccous @mrfeedback <?= is very distinct from <? ?>
# Apr 18th, 16:13 waspinator never heard of it being a problem before
# Apr 18th, 16:13 waspinator you mean this `<?=`
# Apr 18th, 16:11 waspinator https://github.com/cakephp/cakephp.org/blob/master/src/Template/Element/Layout/default/footer/social_links.ctp
# Apr 18th, 16:09 mrfeedback i mean its used everywhere as it seems :slightly_smiling_face:
# Apr 18th, 16:09 mrfeedback cakephp.org\src\Template\Element\Layout\default\footer\social_links.ctp e.g.
# Apr 18th, 16:08 admad where?
# Apr 18th, 16:08 mrfeedback hmm browsing through templates of cakephp.org i realize that you use shorttags for opening and echoing in php. i was told that this feature is often disabled on hosts due to security concerns. or is this not an actual problem anymore?
# Apr 18th, 16:07 admad then make a PR for the docs :slightly_smiling_face:
# Apr 18th, 16:02 mrfeedback ah funny. on the website itself it is removed. but not in the book
# Apr 18th, 15:56 mrfeedback thx
# Apr 18th, 15:50 admad https://github.com/cakephp/cakephp.org
# Apr 18th, 15:49 mrfeedback hmm i have no idea where to put the PR for the website? :slightly_smiling_face:
# Apr 18th, 15:45 admad @mrfeedback make a PR :slightly_smiling_face:
# Apr 18th, 15:42 mrfeedback i think you can remove the Google+ Button on the website :)
# Apr 18th, 15:38 this.impetus @admad check, will do, ty
# Apr 18th, 15:37 admad @this.impetus you might also want to consider https://github.com/admad/cakephp-glide
# Apr 18th, 14:49 ricksaccous lol
# Apr 18th, 14:49 ricksaccous well actually that makes sense
# Apr 18th, 14:49 neon1024 https://github.com/cakephp/cakephp/blob/master/src/Core/ObjectRegistry.php#L97
# Apr 18th, 14:49 ricksaccous or it didn't instantiate it
# Apr 18th, 14:49 ricksaccous i had no idea that it didn't load it until you used it
# Apr 18th, 14:49 this.impetus It alarms me terribly that I understand none of that :P
# Apr 18th, 14:48 ricksaccous interesting
# Apr 18th, 14:48 neon1024 .. a bit like a DI container
# Apr 18th, 14:48 neon1024 As if it can’t find the key, it’ll instantiate the object and set the instance to the key
# Apr 18th, 14:48 neon1024 At least that’s my understanding of how the object registry works
# Apr 18th, 14:48 neon1024 They don’t get instantiated in the registry until you use them anyway
# Apr 18th, 14:47 neon1024 I think it’s such a microscopic enhancement to selectivly load helpers in the controller method
# Apr 18th, 14:47 neon1024 Loading helpers in the AppView I guess
# Apr 18th, 14:47 neon1024 You shouldn’t be loading helpers in a template file
# Apr 18th, 14:46 ricksaccous but i don't think it makes a huge difference
# Apr 18th, 14:46 ricksaccous @neon1024 it probably makes more sense to manipulate that in the view class especially because the response is available to you there
# Apr 18th, 14:45 this.impetus got it. tyvm guys
# Apr 18th, 14:45 ricksaccous yeah that would be loadHelper
# Apr 18th, 14:44 ricksaccous which woul dbe
# Apr 18th, 14:44 ricksaccous yeah i'm saying in controller you would do $this->viewBuilder->setHelpers() and in the view you would use the other method i think
# Apr 18th, 14:43 this.impetus Sigh, I don't really even understand helpers, sorry. I mean conceptually I do, but I don't havea great concept of cake's architecture. What I *want* to achieve is a means of generating mouse-over thumbnails. The front-end JS stuff is where I am actually qualified. if only one class is going to be using this helper, is it not better to load it in the controller?
# Apr 18th, 14:42 neon1024 `$this->_viewBuilder->setHelpers();` ?
# Apr 18th, 14:41 ricksaccous and you would use a different method to do that
# Apr 18th, 14:41 ricksaccous but yes, it's probably better to add them in the AppView class
# Apr 18th, 14:41 ricksaccous you can add helpers that way
# Apr 18th, 14:41 this.impetus TBH, I *always* try. But I learned PHP years ago, and cake before it implemented namespace stuff, and I often find that I don't quite understand the API.
# Apr 18th, 14:41 neon1024 That’s not where you add helpers.
# Apr 18th, 14:41 ricksaccous lol
# Apr 18th, 14:41 ricksaccous he's using viewBuilder in controller
# Apr 18th, 14:40 neon1024 So the method does exist. Which means you must have a typo I’d imagine
# Apr 18th, 14:40 ricksaccous in your case setHelpers is more appropriate
# Apr 18th, 14:40 ricksaccous learn to use that more often and you'll have less questions in general
# Apr 18th, 14:40 neon1024 AppView::loadHelper has been in for 4 years
# Apr 18th, 14:39 ricksaccous ;)
# Apr 18th, 14:39 ricksaccous @this.impetus https://api.cakephp.org/3.7/class-Cake.View.ViewBuilder.html
# Apr 18th, 14:39 this.impetus ```$this->viewBuilder()->getHelpers(['Thumber.Thumb']);``` seems to have pleased cake
# Apr 18th, 14:39 ricksaccous actually it's best to check the API
# Apr 18th, 14:38 this.impetus yeah, haha. thanks. don't be surprised if I come back
# Apr 18th, 14:38 this.impetus anyway, I should at least try to solve this myself
# Apr 18th, 14:38 ricksaccous you can go through the docs to figure it out
# Apr 18th, 14:38 this.impetus but I keep getting errors stating that `loadHelper` isn't a method
# Apr 18th, 14:38 ricksaccous then figure out what the better method to use is
# Apr 18th, 14:38 ricksaccous hehe