# |
Jun 27th 2018, 11:14 |
edgaras.jan |
you need custom SlugRoute class to match if `:slug` is author or tag |
# |
Jun 27th 2018, 10:57 |
a.francazi |
if i go to /tagSlug it tries to find authorSlug and can't find it. I'd like to check it both for author and tag-slug, then open either author or tag page. |
# |
Jun 27th 2018, 10:55 |
a.francazi |
File uploaded https://cakesf.slack.com/files/U7T7YBECA/FBFUBPPBR/-.php / https://slack-files.com/T053DPNCM-FBFUBPPBR-5bff78812f |
# |
Jun 27th 2018, 10:54 |
a.francazi |
is there an easy way to have one route point to multiple actions? |
# |
Jun 27th 2018, 10:19 |
josbeir |
ah you just typed that nm :P |
# |
Jun 27th 2018, 10:19 |
josbeir |
@turkles array_keys($collection->toArray()) ? |
# |
Jun 27th 2018, 10:10 |
turkles |
well.. array_keys($collection->toArray()) works.. eww |
# |
Jun 27th 2018, 10:09 |
neon1024 |
Well it implements Iterator, so perhaps you could just do `array_keys($collection)` ? |
# |
Jun 27th 2018, 10:06 |
turkles |
extract wants a path.. but I can see you can do a callback.. hrm |
# |
Jun 27th 2018, 10:05 |
turkles |
my collection does.. it's come from json data and is in the form 123 => ['data' => 'blah, 'etc' => 'blah], 456 =>... |
# |
Jun 27th 2018, 10:02 |
neon1024 |
https://book.cakephp.org/3.0/en/core-libraries/collections.html#Cake\Collection\Collection::extract |
# |
Jun 27th 2018, 10:02 |
neon1024 |
Probably `extract()` I’d think |
# |
Jun 27th 2018, 10:01 |
neon1024 |
Do they even have keys? |
# |
Jun 27th 2018, 09:56 |
turkles |
Is there a quick way to get a list of keys in a collection? |
# |
Jun 27th 2018, 09:37 |
neon1024 |
Also do check the execution time without debug on |
# |
Jun 27th 2018, 09:37 |
itamer |
My pleasure @gs13006, nice to be able to help and be helped |
# |
Jun 27th 2018, 09:36 |
gs13006 |
@itamer thankyou very much |
# |
Jun 27th 2018, 09:34 |
gs13006 |
Yes, i did it. may be i need to check this again. |
# |
Jun 27th 2018, 09:34 |
itamer |
I run some massive queries, and they're fast - you will be able to fix this |
# |
Jun 27th 2018, 09:33 |
itamer |
Once it's fast in the database, then you can look to see if there are any inefficiencies in your controller and models |
# |
Jun 27th 2018, 09:33 |
itamer |
use debug tools to get the query and see if you can get it running faster in phpMyAdmin or whatever tool you are using. |
# |
Jun 27th 2018, 09:32 |
itamer |
and look at the table type - is it optimised for the type of data you have |
# |
Jun 27th 2018, 09:32 |
itamer |
look at your indexes in the database |
# |
Jun 27th 2018, 09:32 |
itamer |
consider unbinding those tables if the data isn't needed |
# |
Jun 27th 2018, 09:31 |
itamer |
Have a look at your recursive value - cut that down |
# |
Jun 27th 2018, 09:31 |
gs13006 |
yes it is associated with each other. |
# |
Jun 27th 2018, 09:31 |
itamer |
do you need those extra tables loaded every time? |
# |
Jun 27th 2018, 09:31 |
gs13006 |
2x |
# |
Jun 27th 2018, 09:30 |
itamer |
what version of cake @gs13006? |
# |
Jun 27th 2018, 09:30 |
gs13006 |
@itamer I'm running a cakephp website, i have user table and the user table is related with more then 3 table. when i tried to open this it will always taking 20 sec. even i'm crated cache for this. |
# |
Jun 27th 2018, 09:30 |
itamer |
thanks for your help @neon1024 |
# |
Jun 27th 2018, 09:25 |
itamer |
got it :slightly_smiling_face: |
# |
Jun 27th 2018, 09:25 |
itamer |
->Mtypes->name; |
# |
Jun 27th 2018, 09:24 |
itamer |
What's the correct notation when it's a variable on a joined table? |
# |
Jun 27th 2018, 09:24 |
itamer |
My ->name; command at the end will need to change, right? |
# |
Jun 27th 2018, 09:20 |
itamer |
ok, I'm starting to work on that so I'll continue down that path. This part of the site requires very little work so I'm diving into v3 infrequently. I spend most of my time working with v2 where it's super-easy |
# |
Jun 27th 2018, 09:20 |
neon1024 |
Which sidesteps the hasMany issue by inverting the association to a belongsTo making the query join easier :slightly_smiling_face: |
# |
Jun 27th 2018, 09:19 |
neon1024 |
Ah ok, then I would just query `Finances` and contain `Mtypes` |
# |
Jun 27th 2018, 09:19 |
itamer |
ok, thanks, I'll try that - I only need the Mtypes name field value for the most recent payment |
# |
Jun 27th 2018, 09:19 |
neon1024 |
I guess a third, and little more obscure way, would be to use a subquery |
# |
Jun 27th 2018, 09:18 |
neon1024 |
In which case, if you don’t want that, you’ll want to use `matching()` to filter the `Mtypes` by the associated `Finances` |