# |
Jun 14th 2021, 19:49 |
kevin.pfeifer |
oh well :) |
# |
Jun 14th 2021, 19:49 |
jh |
I think I started with CakePHP 1.1 :) |
# |
Jun 14th 2021, 19:49 |
jh |
And this one https://www.youtube.com/watch?v=JvBT4XBdoUE .. elixir is much more a general purpose tool, probably good for most but drivers and 3d engines, especially good for IOT (nerves) and web apps |
# |
Jun 14th 2021, 19:48 |
kevin.pfeifer |
to be honest, i started with cake 3.0 and just gradually upgraded my main app over time. Just happened to have to “rewrite” a lot of code anyway when the 4.0 beta came out |
# |
Jun 14th 2021, 19:48 |
jh |
yes I know cakephp for ages I just am used to maintain and extend 3.7-3.9 apps now and nothing more |
# |
Jun 14th 2021, 19:47 |
kevin.pfeifer |
oho nice, will definitely watch that, thx |
# |
Jun 14th 2021, 19:47 |
kevin.pfeifer |
but basically if you stick with the cakephp naming conventions you can easily generate your basic functionality :) |
# |
Jun 14th 2021, 19:47 |
jh |
To just give you an impression https://www.youtube.com/watch?v=MZvmYaFkNJI |
# |
Jun 14th 2021, 19:47 |
jh |
functional, process oriented, compiled (mostly) |
# |
Jun 14th 2021, 19:46 |
kevin.pfeifer |
ok, never dipped into these lands :,) |
# |
Jun 14th 2021, 19:46 |
jh |
Phoenix is Rails on Elixir |
# |
Jun 14th 2021, 19:46 |
jh |
Elixir is glorified Erlang |
# |
Jun 14th 2021, 19:45 |
kevin.pfeifer |
what the hell is even phoenix/elixir, never heard of that |
# |
Jun 14th 2021, 19:44 |
kevin.pfeifer |
what If you remove the ```>prefix('Admin'``` and write your inner write with your patterns including the admin part? Like ``` $patterns = ['language' => 'en|ar']; $routes ->connect('/{language}/admin/:controller/:action/*', []) ->setPatterns($patterns);``` |
# |
Jun 14th 2021, 19:43 |
jh |
I ll write a new one - the alternative would be laravel + cakephp3 orm :D… sadly the project is too small for phoenix/elixir |
# |
Jun 14th 2021, 19:41 |
slackebot |
<alamnaryab> |
# |
Jun 14th 2021, 19:40 |
greg138 |
I try to answer the "easy" questions when I can, so that the real experts have time to answer mine. ;) |
# |
Jun 14th 2021, 19:39 |
tomrwaller |
OK cool - I'll have a play around with both and see if I can get my head aound it. Thank you @greg138 and @kevin.pfeifer - you've both been really helpful. Concious I've been asking a lot of questions lately but this community has always gone above and beyond. It's much appreciated. |
# |
Jun 14th 2021, 19:37 |
greg138 |
I mean, I think I like the `baselines_ids` solution better. It was empty, but that's because the field name didn't match what you had in the form. You said if you make the form match, then you have to set the label manually. I think that's the better solution. |
# |
Jun 14th 2021, 19:37 |
alamnaryab |
I tried above without scope it is working for non-admin, but for admin how can I do where I need language parameter before admin prefix |
# |
Jun 14th 2021, 19:36 |
tomrwaller |
I don't think so - as I mentioned, it's working as per your suggestion to use ['baselines']['_ids']. |
# |
Jun 14th 2021, 19:35 |
greg138 |
Is there some other problem with using `baselines_ids` instead of `baselines._ids`? |
# |
Jun 14th 2021, 19:35 |
greg138 |
Iterating through one array or another is a largely meaningless distinction IMO. |
# |
Jun 14th 2021, 19:34 |
tomrwaller |
Gotcha - so would there be a better way - maybe some how iterate through the entities or something? Instead of dealing with the array of IDs? |
# |
Jun 14th 2021, 19:33 |
greg138 |
If the only problem with the `baselines_ids` method is that the label isn't right on the input field, then just add `'label' => 'whatever'` when you create the input field. |
# |
Jun 14th 2021, 19:33 |
kevin.pfeifer |
I only updated 1 CakePHP 3 app to 4 till now but I would say it mainly depends on how much custom code you have. If you stick to the generated code the bake console gave you then you will not have a hard time upgrading to cake4 |
# |
Jun 14th 2021, 19:32 |
greg138 |
Honestly, I don't love it. `._ids` is there for a specific use case, which is not the same as your use case. So, you are getting the functionality you want but it's basically because of a convenient side effect, not because you're using it as expected. To me, that brings with it a decent chance that somewhere along the line it will break because of changes made elsewhere, and it may take a while to notice that it's broken. |
# |
Jun 14th 2021, 19:31 |
tomrwaller |
What would be the best way to debug that? I'm new (I still learning if that wasn't obvious already :) ) |
# |
Jun 14th 2021, 19:30 |
greg138 |
Then it's *probably* okay... |
# |
Jun 14th 2021, 19:29 |
tomrwaller |
I'm not seeing any baselines being created if that's what you mean? |
# |
Jun 14th 2021, 19:29 |
greg138 |
Just be careful to check that it really is working 100%, and not working for what you're looking at so far but also creating other records / associations that you don't actually want. |
# |
Jun 14th 2021, 19:28 |
tomrwaller |
So a follow-up then if you don't mind... Is this the best way to do this? I mean it works right :) but I wonder if I'm doing something I shouldn't be. |
# |
Jun 14th 2021, 19:27 |
greg138 |
Look at your entity after patching, you may have a `baselines` array in there with stuff you don't really want? |
# |
Jun 14th 2021, 19:27 |
tomrwaller |
Aha - thank you both :) ['baselines']['_ids'] does indeed work! I think this is acceptable to me - I only want to create answer records, not baselines. Baselines simply contain a whole bunch of recommendations. I need an answer for every recommendation across whatever baselines a user has selected. |
# |
Jun 14th 2021, 19:26 |
greg138 |
It could cover every use case, but then it would still be on beta version 0.9.12796. |
# |
Jun 14th 2021, 19:25 |
kevin.pfeifer |
but why though /s :,) |
# |
Jun 14th 2021, 19:25 |
greg138 |
Cake can't possibly do *everything* out of the box, there's always going to be some custom coding required. |
# |
Jun 14th 2021, 19:23 |
greg138 |
Before changing to this, you should very much be aware of exactly what `_ids` is doing, in terms of records being created in the database. It looks to me like what you get if you do that might not be at all what you want. In which case using your custom field name could be the right way to go, and all you need to do is manually specify the label for the input field. |
# |
Jun 14th 2021, 19:22 |
kevin.pfeifer |
indeed |
# |
Jun 14th 2021, 19:22 |
greg138 |
So, `$data['baselines._ids']` would indeed be blank, but `$data['baselines']['_ids']` would not be. |
# |
Jun 14th 2021, 19:21 |
kevin.pfeifer |
I am on Cake 4.2.6 |