Logs for #cakephp

Page 1 of 36,098, showing 100 records out of 3,609,707 total, starting on record 1, ending on 100

# At Username Text
# Today, 11:55 admad the autocomplete is contextual and it will list only methods of current class, so it's not like you are going to get multiple "create" in the list
# Today, 11:53 mehov I thought having a noun first would kind of help when you're looking up that function in the list (so it'd all get sorted by it), but I guess that's not important
# Today, 11:52 admad no need for "createAccount()
# Today, 11:51 admad I would actually drop the noun too. Cause for eg. $this->Accounts->create() is good enough
# Today, 11:51 mehov Got it, thanks a lot!
# Today, 11:51 admad nmv, using the verb first is common practice
# Today, 11:50 admad in which class?
# Today, 11:49 mehov Hi guys, what do you think would be a better practice, naming methods `createAccount()` and `deleteAccount()` or `accountCreate()` and `accountDelete()`? Checked book.cakephp.org/3.0/en/intro/conventions.html and it says *While you can route multiple word controllers in any way you like*. Nothing on https://www.dereuromark.de/2010/10/08/complete-cakephp-naming-conventions/ either
# Today, 11:15 asdfgh thanks
# Today, 11:15 asdfgh ok
# Today, 11:07 royalty and then you can add caching to those, using findBy is just a quick convenience method that you should probably avoid
# Today, 11:07 royalty or getById(int $id)
# Today, 11:07 royalty getByWhatever(string $param)
# Today, 11:07 royalty like
# Today, 11:07 royalty asdfgh, it's better to define your own findBy queries
# Today, 11:06 asdfgh i have tried to add cache() but it is not recognized
# Today, 11:06 asdfgh ricks it seems that we cannot use cache() for findBy... queries
# Today, 11:05 ricksaccous it might work without using TableRegistry
# Today, 11:05 ricksaccous so if you want to try again with tableLocator
# Today, 11:04 asdfgh yes correct
# Today, 11:03 ricksaccous you'd have to do TableLocator->get();
# Today, 11:03 ricksaccous the mistake you might be making is if you use TableLocator::get it won't work because the method is not static
# Today, 11:03 asdfgh debug(TableRegistry::getTableLocator()->get("ActivityTypes")->findByActivity('view')->first());
# Today, 11:03 ricksaccous it seems that
# Today, 11:03 asdfgh ricks your code works!
# Today, 11:01 ricksaccous oh weird
# Today, 11:00 asdfgh thanks
# Today, 11:00 asdfgh ok i try
# Today, 11:00 asdfgh i mean tableregistry is still working but i would like to understand how to use tablelocator
# Today, 11:00 asdfgh we must use tablelocator
# Today, 11:00 asdfgh ricksaccous i read it is deprecated in 4
# Today, 10:58 ricksaccous then you should be able to do $activityType->id
# Today, 10:57 ricksaccous $activityType = $activityTypesTable->findByActivity('view')->first();
# Today, 10:57 ricksaccous so like $activityTypesTable = TableRegistry::getTableLocator->get('Activitytypes');
# Today, 10:56 ricksaccous I think that you should first set the table to a variable, and isn't TableRegistry the recommended way to do that?
# Today, 10:47 asdfgh anyone?
# Today, 10:13 asdfgh and i have to get the ID of that record that has value "view"
# Today, 10:12 asdfgh basically i have a filed named "activity" in the activity_types table
# Today, 10:12 asdfgh why?
# Today, 10:12 asdfgh i get this error: Using $this when not in object context
# Today, 10:12 asdfgh $activityType = TableLocator::get('ActivityTypes')->findByActivity('view')->first();
# Today, 10:12 asdfgh hello
# Today, 00:27 kanryu How do I define a Model that does not inherit Table in Cakephp 3 and use it from the Controller?
# Yesterday, 21:20 leonardo.crecente I have a question, it's more about html than cakephp. Hope you can help me. I have a website layout in mobile and desktop versions. The navigation menu layout changes a lot from mobile to desktop. Is there any problem on using a html structure for each navigation? I'd hide via css the mobile nav on desktop and vice versa
# Yesterday, 21:04 maymeow When I use 'plugin.Identity.Users' fixture it ends with error that can't find fixture
# Yesterday, 21:03 maymeow So I have identity plugin installed in vendor
# Yesterday, 20:57 admad you can
# Yesterday, 20:34 maymeow Can I use fixture from vendor plugin or I have to extend it in my tests?
# Yesterday, 17:52 devito in cake 2 is there a databaseengine for caching?
# Yesterday, 17:52 ricksaccous which is lengthy for many records*
# Yesterday, 17:52 ricksaccous which may be lengthy
# Yesterday, 17:52 ricksaccous saveMany will always expect hydrated entities in
# Yesterday, 17:51 ricksaccous raw queries always best option
# Yesterday, 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?
# Yesterday, 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
# Yesterday, 17:37 pedrorocha Thank you!
# Yesterday, 17:36 ricksaccous what*
# Yesterday, 17:36 ricksaccous ....
# Yesterday, 17:36 ricksaccous i think that he linked up there is sufficient
# Yesterday, 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?
# Yesterday, 17:34 ricksaccous thanks
# Yesterday, 17:33 ricksaccous interesting, i'll consider this if i run into bottlenecks
# Yesterday, 17:33 admad update or insert depending on what you need
# Yesterday, 17:33 admad use what i linked above
# Yesterday, 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?
# Yesterday, 17:31 admad https://book.cakephp.org/3.0/en/orm/query-builder.html#inserting-data
# Yesterday, 17:31 ricksaccous yeah ;)
# Yesterday, 17:31 ricksaccous using the ORM to just build the raw save query
# Yesterday, 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?
# Yesterday, 17:31 ricksaccous and probably skipping to raw sql saves is faster
# Yesterday, 17:30 ricksaccous i'd just be worried about the patchEntities anyway
# Yesterday, 17:30 admad ORM methods are meant for bulk saves anyway. Use lower level db methods
# Yesterday, 17:30 ricksaccous no you'd have to do a saveMany
# Yesterday, 17:30 pedrorocha ->save() accepts my whole array of data?
# Yesterday, 17:29 ricksaccous in one query
# Yesterday, 17:29 ricksaccous @pedrorocha why not save 15k per loop pass
# Yesterday, 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?
# Yesterday, 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
# Yesterday, 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 =
# Yesterday, 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
# Yesterday, 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
# Yesterday, 16:32 admad @mrfeedback `<?=` is short echo, different than short open tag. It's unaffected by php config and always available
# Yesterday, 16:20 mrfeedback `Note that this directive does not control the <?= shorthand tag, which can be ; used regardless of this directive.`
# Yesterday, 16:20 mrfeedback oh. okay forget what i said
# Yesterday, 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
# Yesterday, 16:14 ricksaccous the second is never used
# Yesterday, 16:13 ricksaccous @mrfeedback <?= is very distinct from <? ?>
# Yesterday, 16:13 waspinator never heard of it being a problem before
# Yesterday, 16:13 waspinator you mean this `<?=`
# Yesterday, 16:11 waspinator https://github.com/cakephp/cakephp.org/blob/master/src/Template/Element/Layout/default/footer/social_links.ctp
# Yesterday, 16:09 mrfeedback i mean its used everywhere as it seems :slightly_smiling_face:
# Yesterday, 16:09 mrfeedback cakephp.org\src\Template\Element\Layout\default\footer\social_links.ctp e.g.
# Yesterday, 16:08 admad where?
# Yesterday, 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?
# Yesterday, 16:07 admad then make a PR for the docs :slightly_smiling_face:
# Yesterday, 16:02 mrfeedback ah funny. on the website itself it is removed. but not in the book
# Yesterday, 15:56 mrfeedback thx
# Yesterday, 15:50 admad https://github.com/cakephp/cakephp.org
# Yesterday, 15:49 mrfeedback hmm i have no idea where to put the PR for the website? :slightly_smiling_face:
# Yesterday, 15:45 admad @mrfeedback make a PR :slightly_smiling_face: