# |
Feb 25th 2018, 15:10 |
muerte |
? |
# |
Feb 25th 2018, 15:10 |
muerte |
or you mean your app sandbox: https://github.com/dereuromark/cakephp-sandbox |
# |
Feb 25th 2018, 15:10 |
muerte |
where is sandbox? |
# |
Feb 25th 2018, 15:09 |
madrid988 |
that would be an easy rule to remember. |
# |
Feb 25th 2018, 15:08 |
madrid988 |
If I have an array being sent back to an html form, those keys will be sent back as data fields so I use underscore for those? |
# |
Feb 25th 2018, 15:04 |
admad |
if you notice all config keys in options for various core classes are camelCased |
# |
Feb 25th 2018, 15:03 |
admad |
madrid988: yes, underscore only for db fields, else camelCase |
# |
Feb 25th 2018, 15:03 |
madrid988 |
I would like to match the conventions cake used |
# |
Feb 25th 2018, 15:03 |
madrid988 |
Does anyone know the convention CakePHP uses for array key names? Should I only use underscore_case when the key represents a database field, and use titleCase for all other array keys? If I have an array which represents data, should I use underscore_case? |
# |
Feb 25th 2018, 14:51 |
dereuromark |
should work just fine either way, see the sandbox app. |
# |
Feb 25th 2018, 14:51 |
dereuromark |
which is correct, but probably not even needed |
# |
Feb 25th 2018, 14:50 |
muerte |
I think Plugin::load('Calendar'); was is add by bake plugin load |
# |
Feb 25th 2018, 14:34 |
spriz |
#sunday |
# |
Feb 25th 2018, 14:33 |
spriz |
Aye… git reset it is :,) |
# |
Feb 25th 2018, 14:32 |
hmic |
you'll just need the very same beforeFilter() methid in that component too, nothing else |
# |
Feb 25th 2018, 14:31 |
hmic |
well... you might revisit that |
# |
Feb 25th 2018, 14:31 |
spriz |
and also because I thought component was over-engineering it |
# |
Feb 25th 2018, 14:31 |
spriz |
because I liked `use RequiresActiveAccountTrait;` better than putting `$this->loadComponent(‘RequiresActiveAccount’);` |
# |
Feb 25th 2018, 14:31 |
hmic |
for what reason? |
# |
Feb 25th 2018, 14:30 |
spriz |
Yeah, actually I moved away from a Component :,) |
# |
Feb 25th 2018, 14:30 |
hmic |
you might be better off implementing a component in your case |
# |
Feb 25th 2018, 14:30 |
hmic |
or you aim for exactly that exclusively ;-) |
# |
Feb 25th 2018, 14:30 |
hmic |
well, you add to a class with a trait, you don't aim for things that *might* exist beforehand |
# |
Feb 25th 2018, 14:29 |
spriz |
I’ll revisit the design later, I guess :slightly_smiling_face: |
# |
Feb 25th 2018, 14:29 |
spriz |
It works, but it’s still “ugly” :P |
# |
Feb 25th 2018, 14:28 |
hmic |
if thats your initial problem, you've got it right now |
# |
Feb 25th 2018, 14:28 |
hmic |
and, of course, your method name needs to be different from beforeFilter in the trait ;-) |
# |
Feb 25th 2018, 14:28 |
spriz |
Ah true. |
# |
Feb 25th 2018, 14:28 |
hmic |
but that again only works, if your controller does not have it too |
# |
Feb 25th 2018, 14:28 |
muerte |
but now I change to Plugin::load('Calendar.Calendar'); |
# |
Feb 25th 2018, 14:28 |
hmic |
thats the other solution spritz, have implementedEvents in the trait |
# |
Feb 25th 2018, 14:27 |
muerte |
sorry I add Plugin::load('Calendar'); |
# |
Feb 25th 2018, 14:27 |
dereuromark |
muerte: but is written there black on white - directly at the beginning |
# |
Feb 25th 2018, 14:27 |
spriz |
other names fixed it :slightly_smiling_face: https://gist.github.com/Spriz/efa8a9a774bf20fd3b7737eff679e2bd |
# |
Feb 25th 2018, 14:26 |
spriz |
Sure is my fault :) |
# |
Feb 25th 2018, 14:26 |
muerte |
no, I not add anything to bootstrap |
# |
Feb 25th 2018, 14:25 |
dereuromark |
muerte: i meant if you loaded it properly in your bootstrap |
# |
Feb 25th 2018, 14:25 |
hmic |
or you implement a baseclass to use like in the php example (just put the stub baseclass in the same file and extend it on the spot) |
# |
Feb 25th 2018, 14:24 |
hmic |
spritz: your fault :P traits dont automagically execute some setup functionality so you would need implementedEvents (and make sure your controller does not have it either) in the trait |
# |
Feb 25th 2018, 14:24 |
muerte |
I add this in Template/Users/index.ctp |
# |
Feb 25th 2018, 14:23 |
muerte |
https://gist.github.com/anonymous/9f4ad078ffaa9f3bba6327b4a020f728 |