# |
Apr 25th 2019, 12:21 |
val |
Hi, has anybody tried to use namespaces in cake 2.x instead of `App::uses()`? |
# |
Apr 25th 2019, 12:14 |
admad |
kiwi_14: this might help you https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group |
# |
Apr 25th 2019, 12:05 |
kiwi_14 |
So, i have 3 Tables : "Category", "Host" and "Experience". I would like to get 12 max experiences by Category. |
# |
Apr 25th 2019, 12:04 |
Martin` |
bad request? |
# |
Apr 25th 2019, 12:03 |
mrgrimpy |
And what type of error would you suggest I throw if the request header !== application/json? |
# |
Apr 25th 2019, 12:02 |
np |
what is problem? |
# |
Apr 25th 2019, 12:02 |
Martin` |
Just drop the question :) |
# |
Apr 25th 2019, 12:01 |
kiwi_14 |
Hi, i have a problem with Cake's ORM, is someone available to help ? |
# |
Apr 25th 2019, 12:00 |
admad |
@mrgrimpy though i would suggests allowing access to URL without .json extension too but if request had Accept: application/json header. For that you just need to use `$this->request->is('json')` instead of checking for `_ext` param. |
# |
Apr 25th 2019, 11:59 |
admad |
welcome |
# |
Apr 25th 2019, 11:58 |
mrgrimpy |
Thank you for your help, and for your I18n plugin |
# |
Apr 25th 2019, 11:58 |
admad |
:slightly_smiling_face: |
# |
Apr 25th 2019, 11:58 |
mrgrimpy |
Already done lol |
# |
Apr 25th 2019, 11:58 |
mrgrimpy |
Indeed :slightly_smiling_face: |
# |
Apr 25th 2019, 11:58 |
admad |
what i suggested above is easier |
# |
Apr 25th 2019, 11:57 |
admad |
while ensuring that no other mapped routes map to your particular action |
# |
Apr 25th 2019, 11:57 |
admad |
to do it at routes level you will have to connect connect required routes with `.json` paths without enabling extension parsing |
# |
Apr 25th 2019, 11:55 |
mrgrimpy |
I just tought there was a way to handle it at routes level |
# |
Apr 25th 2019, 11:55 |
mrgrimpy |
Will do |
# |
Apr 25th 2019, 11:55 |
mrgrimpy |
Yes I am |
# |
Apr 25th 2019, 11:55 |
admad |
that's assuming you are using extension parsing in router |
# |
Apr 25th 2019, 11:53 |
admad |
then just check `$this->request->getParam('_ext')` and throw `NotFoundException` if the value is not `'json'`. |
# |
Apr 25th 2019, 11:52 |
mrgrimpy |
Only for two specific actions |
# |
Apr 25th 2019, 11:52 |
admad |
you want that throughout the site or just for particular controller/action? |
# |
Apr 25th 2019, 11:50 |
slackebot |
was told to try making a custom routes class but I feel there must be a more «CakePHP way». |
# |
Apr 25th 2019, 11:50 |
mrgrimpy |
@admad I am sorry if you felt I put some blame on your I18n plugin yesterday when I was asking questions on CakePHP routing. I thank you for it. It works really well for our needs. Since you're a specialist on routes. Could you point me towards what would be the best course of action if I wanted to throw 404s for https://www.example.com but respond with json for https://www.example.com.json? I couldn't find anything in the documentation. I |
# |
Apr 25th 2019, 11:46 |
admad |
@mrgrimpy please don't PM for support issues, just ask in here |
# |
Apr 25th 2019, 11:20 |
slackebot |
Action: neon1024 goes back to the corner |
# |
Apr 25th 2019, 11:20 |
neon1024 |
:point_up: Yeah, a result set of `0` :face_palm: |
# |
Apr 25th 2019, 11:19 |
neon1024 |
Ah, perhaps my find didn’t find any records :thinking_face: |
# |
Apr 25th 2019, 11:18 |
neon1024 |
My shell sets the fields as dirty, and I save them, but they mutator doesn’t seem to fire. Any thoughts? |
# |
Apr 25th 2019, 11:18 |
neon1024 |
I need to run a shell to write new field values. I’ve setup an entity mutator to write the new fields, as they’re derived. |
# |
Apr 25th 2019, 11:17 |
neon1024 |
In other news |
# |
Apr 25th 2019, 11:07 |
neon1024 |
I guess it all depends how much functionality you want to implement, how much time you have and what your budget is if there is one |
# |
Apr 25th 2019, 11:06 |
neon1024 |
Perhaps you’d need to use like a remember me cookie for that |
# |
Apr 25th 2019, 11:06 |
neon1024 |
As if I logged in, and the login method marked my user as logged in, if I close the browser I’d lose my session |
# |
Apr 25th 2019, 11:05 |
neon1024 |
As it would make logging out more important, and it would also mean session resumption would be an issue |
# |
Apr 25th 2019, 11:05 |
neon1024 |
..but I’d be a bit worried about how to log someone out |
# |
Apr 25th 2019, 11:05 |
neon1024 |
You’d have to store something in persistant storage for me |
# |
Apr 25th 2019, 11:02 |
thomas078 |
What is the easiest way to prevent same username to log in multiple times 2 at same time? |
# |
Apr 25th 2019, 10:05 |
egalles |
thx i was turning mad :) |