# |
Jun 12th 2018, 10:09 |
Martin` |
but Don't have time to refactor it now |
# |
Jun 12th 2018, 10:09 |
Martin` |
Yes I don't understant why it uses the modelname and id in the key of te array |
# |
Jun 12th 2018, 10:08 |
neon1024 |
Although, as it’s upgrading an old helper. I’d be more tempted to refactor the helper myself |
# |
Jun 12th 2018, 10:08 |
neon1024 |
Then you can use that in the collection method to build the index |
# |
Jun 12th 2018, 10:07 |
neon1024 |
If you want to concatenate `name` and `id` I would use an entity mutator method for that |
# |
Jun 12th 2018, 10:07 |
neon1024 |
This is what I’d look at first |
# |
Jun 12th 2018, 10:07 |
neon1024 |
https://book.cakephp.org/3.0/en/core-libraries/collections.html#Cake\Collection\Collection::indexBy |
# |
Jun 12th 2018, 10:06 |
Martin` |
I've converted that helper from our cakephp 1.3 project, I really like to change some things, but better to just format it the way it likes :P |
# |
Jun 12th 2018, 10:06 |
neon1024 |
I agree with arnis then, I’d use a Collection method |
# |
Jun 12th 2018, 10:06 |
Martin` |
Well I'm using a view helper to select multiple users. but that helper needs the data as an array: [users_231 => ['id' => 231, 'name' => 'Pieter']] etc |
# |
Jun 12th 2018, 10:05 |
slackebot |
!xy |
# |
Jun 12th 2018, 10:05 |
slackebot |
Command sent from Slack by neon1024: |
# |
Jun 12th 2018, 10:05 |
neon1024 |
But do tell use your use-case, as it sounds like |
# |
Jun 12th 2018, 10:05 |
neon1024 |
The third is to use an Entity mutator method |
# |
Jun 12th 2018, 10:05 |
neon1024 |
As arnis said, the first one is Collections, as you said, the second is formatResults, which actually uses the Collections |
# |
Jun 12th 2018, 10:04 |
neon1024 |
There are three approaches, depending on what you need to do |
# |
Jun 12th 2018, 10:04 |
arnis |
what do you mean by "format the data the way I need" ? |
# |
Jun 12th 2018, 10:04 |
Martin` |
only I cant' change the key in array I think |
# |
Jun 12th 2018, 10:03 |
Martin` |
yes list is not what I need but add 'formatResults' to query I think I can format the data the way I need? |
# |
Jun 12th 2018, 10:02 |
arnis |
find('list') maybe works for you. With custom finder you will adjust your querie to suit your needs. |
# |
Jun 12th 2018, 10:00 |
arnis |
use collections for that |
# |
Jun 12th 2018, 09:58 |
Martin` |
inder=finder |
# |
Jun 12th 2018, 09:58 |
Martin` |
Don't know what the best way is to do that, or is it the best to just create a custom inder and call formatResults? |
# |
Jun 12th 2018, 09:57 |
Martin` |
Can I also make a custom function in table for toArray() ? of something like that, I need the data in some other format than default :) |
# |
Jun 12th 2018, 09:42 |
lorenzo |
@neon1024 but the amount of cake in seatgeek is steadily growing :) |
# |
Jun 12th 2018, 09:42 |
lorenzo |
@neon1024 mostly operations for me, actaully |
# |
Jun 12th 2018, 09:37 |
josbeir |
i personally am not a big fan of BS but i'm seeing the producivity benefit ofcourse :slightly_smiling_face: |
# |
Jun 12th 2018, 09:36 |
slackebot |
Action: josbeir hides |
# |
Jun 12th 2018, 09:36 |
josbeir |
was facing the same issue for a new cake project recently and decided that the extra work effort i would have put to make bs4 working correctly was best spent elsewhere... i needed it for a backend, so i just created something from scratch ... |
# |
Jun 12th 2018, 09:34 |
josbeir |
right.. |
# |
Jun 12th 2018, 09:31 |
arnis |
already tried lilhermit plugin, also working partialy. Looks like it for BS 4.0 or some kind a beta 4.x. |
# |
Jun 12th 2018, 09:28 |
josbeir |
but it seemed to work ok |
# |
Jun 12th 2018, 09:28 |
josbeir |
its less featured tho |
# |
Jun 12th 2018, 09:27 |
josbeir |
(there was an alternative bs4 plugin too => https://packagist.org/packages/lilhermit/cakephp-plugin-bootstrap4 |
# |
Jun 12th 2018, 09:26 |
neon1024 |
My work I mean |
# |
Jun 12th 2018, 09:26 |
neon1024 |
We haven’t moved over to Bootstrap 4 just yet, so I haven’t tried it |
# |
Jun 12th 2018, 09:25 |
neon1024 |
So any code you could help with would be super |
# |
Jun 12th 2018, 09:25 |
neon1024 |
Unfortunately jadb has kind of vanished, and left @admad with the project really |
# |
Jun 12th 2018, 09:24 |
neon1024 |
Then we can work on getting those updated :slightly_smiling_face: |
# |
Jun 12th 2018, 09:24 |
neon1024 |
arnis, Would you mind opening issues for them? Or proposing some code fixes with a pull request? |
# |
Jun 12th 2018, 09:24 |
arnis |
:/ |