# |
Apr 19th 2019, 11:04 |
asdfgh |
yes correct |
# |
Apr 19th 2019, 11:03 |
ricksaccous |
you'd have to do TableLocator->get(); |
# |
Apr 19th 2019, 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 |
# |
Apr 19th 2019, 11:03 |
asdfgh |
debug(TableRegistry::getTableLocator()->get("ActivityTypes")->findByActivity('view')->first()); |
# |
Apr 19th 2019, 11:03 |
ricksaccous |
it seems that |
# |
Apr 19th 2019, 11:03 |
asdfgh |
ricks your code works! |
# |
Apr 19th 2019, 11:01 |
ricksaccous |
oh weird |
# |
Apr 19th 2019, 11:00 |
asdfgh |
thanks |
# |
Apr 19th 2019, 11:00 |
asdfgh |
ok i try |
# |
Apr 19th 2019, 11:00 |
asdfgh |
i mean tableregistry is still working but i would like to understand how to use tablelocator |
# |
Apr 19th 2019, 11:00 |
asdfgh |
we must use tablelocator |
# |
Apr 19th 2019, 11:00 |
asdfgh |
ricksaccous i read it is deprecated in 4 |
# |
Apr 19th 2019, 10:58 |
ricksaccous |
then you should be able to do $activityType->id |
# |
Apr 19th 2019, 10:57 |
ricksaccous |
$activityType = $activityTypesTable->findByActivity('view')->first(); |
# |
Apr 19th 2019, 10:57 |
ricksaccous |
so like $activityTypesTable = TableRegistry::getTableLocator->get('Activitytypes'); |
# |
Apr 19th 2019, 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? |
# |
Apr 19th 2019, 10:47 |
asdfgh |
anyone? |
# |
Apr 19th 2019, 10:13 |
asdfgh |
and i have to get the ID of that record that has value "view" |
# |
Apr 19th 2019, 10:12 |
asdfgh |
basically i have a filed named "activity" in the activity_types table |
# |
Apr 19th 2019, 10:12 |
asdfgh |
why? |
# |
Apr 19th 2019, 10:12 |
asdfgh |
i get this error: Using $this when not in object context |
# |
Apr 19th 2019, 10:12 |
asdfgh |
$activityType = TableLocator::get('ActivityTypes')->findByActivity('view')->first(); |
# |
Apr 19th 2019, 10:12 |
asdfgh |
hello |
# |
Apr 19th 2019, 00:27 |
kanryu |
How do I define a Model that does not inherit Table in Cakephp 3 and use it from the Controller? |
# |
Apr 18th 2019, 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 |
# |
Apr 18th 2019, 21:04 |
maymeow |
When I use 'plugin.Identity.Users' fixture it ends with error that can't find fixture |
# |
Apr 18th 2019, 21:03 |
maymeow |
So I have identity plugin installed in vendor |
# |
Apr 18th 2019, 20:57 |
admad |
you can |
# |
Apr 18th 2019, 20:34 |
maymeow |
Can I use fixture from vendor plugin or I have to extend it in my tests? |
# |
Apr 18th 2019, 17:52 |
devito |
in cake 2 is there a databaseengine for caching? |
# |
Apr 18th 2019, 17:52 |
ricksaccous |
which is lengthy for many records* |
# |
Apr 18th 2019, 17:52 |
ricksaccous |
which may be lengthy |
# |
Apr 18th 2019, 17:52 |
ricksaccous |
saveMany will always expect hydrated entities in |
# |
Apr 18th 2019, 17:51 |
ricksaccous |
raw queries always best option |
# |
Apr 18th 2019, 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 2019, 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 2019, 17:37 |
pedrorocha |
Thank you! |
# |
Apr 18th 2019, 17:36 |
ricksaccous |
what* |
# |
Apr 18th 2019, 17:36 |
ricksaccous |
.... |
# |
Apr 18th 2019, 17:36 |
ricksaccous |
i think that he linked up there is sufficient |
# |
Apr 18th 2019, 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? |