# |
Nov 23rd 2017, 11:53 |
lorenzo |
but as I have demonstrated to many already, there is no one solution to fix all possible scenarios |
# |
Nov 23rd 2017, 11:53 |
lorenzo |
@dereuromark I have a solution I’ve been sharing around |
# |
Nov 23rd 2017, 11:51 |
admad |
@birdy247 guess i was wrong about the event. Never needed it since i can just setup required config before calling execute() |
# |
Nov 23rd 2017, 11:49 |
birdy247 |
I am assuming this is wildy wrong |
# |
Nov 23rd 2017, 11:47 |
birdy247 |
File uploaded https://cakesf.slack.com/files/U0T295QA3/F85HTA43Y/-.php / https://slack-files.com/T053DPNCM-F85HTA43Y-d63ce4dd65 |
# |
Nov 23rd 2017, 11:47 |
birdy247 |
I had this |
# |
Nov 23rd 2017, 11:47 |
birdy247 |
and set the to what my custom datatype exepctes |
# |
Nov 23rd 2017, 11:47 |
birdy247 |
but lets say I wanted to take the date and timezone attributes from my api POST request |
# |
Nov 23rd 2017, 11:46 |
birdy247 |
@neon1024 I am maybe oversimplfying things |
# |
Nov 23rd 2017, 11:39 |
acosonic |
So, anyone, webmail client written in cakephp ? some github |
# |
Nov 23rd 2017, 11:35 |
neon1024 |
I fell into that hole yesterday and it’s not a nice hole :P |
# |
Nov 23rd 2017, 11:35 |
neon1024 |
Just make sure you use the authorization header for your api and not a custom header |
# |
Nov 23rd 2017, 11:35 |
neon1024 |
Crud is super flexible like that <3 |
# |
Nov 23rd 2017, 11:35 |
neon1024 |
I mean you don’t even need to do that if you don’t want to |
# |
Nov 23rd 2017, 11:35 |
neon1024 |
As long as you return `$this->Crud->execute()` you can do whatever you want in the controller method |
# |
Nov 23rd 2017, 11:34 |
neon1024 |
Just do some stuff, then pass off to Crud |
# |
Nov 23rd 2017, 11:33 |
neon1024 |
Me? No, I’d just change the data array in the controller most likely |
# |
Nov 23rd 2017, 11:33 |
birdy247 |
in beforeMarsahal? |
# |
Nov 23rd 2017, 11:33 |
birdy247 |
:+1: |
# |
Nov 23rd 2017, 11:33 |
neon1024 |
But that would be my approach anyway, I’d make the ajax nice and simple and obvious, then I’d do a spot of data manipulation in PHP :slightly_smiling_face: |
# |
Nov 23rd 2017, 11:32 |
neon1024 |
Crud adds events, it doesn’t replace the core ones :slightly_smiling_face: |
# |
Nov 23rd 2017, 11:31 |
birdy247 |
is there a beforeMarshal event I can use with crud? |
# |
Nov 23rd 2017, 11:31 |
neon1024 |
Just post the stuff and fix it in PHP |
# |
Nov 23rd 2017, 11:31 |
neon1024 |
You don’t need to make your front-end complicated |
# |
Nov 23rd 2017, 11:31 |
neon1024 |
So give it what it wants |
# |
Nov 23rd 2017, 11:31 |
birdy247 |
the string and timezone |
# |
Nov 23rd 2017, 11:31 |
birdy247 |
which expects an array of dates |
# |
Nov 23rd 2017, 11:31 |
birdy247 |
I have a custom data type |
# |
Nov 23rd 2017, 11:30 |
neon1024 |
Don’t tie your own shoelaces together before the race and then cry when you fall over! |
# |
Nov 23rd 2017, 11:30 |
neon1024 |
Well just use `date` and `timezone` then |
# |
Nov 23rd 2017, 11:30 |
birdy247 |
but this is an ajax post request |
# |
Nov 23rd 2017, 11:30 |
neon1024 |
Why you don’t you use `Y-m-d H:i:s` ? |
# |
Nov 23rd 2017, 11:29 |
birdy247 |
yes, works fine |
# |
Nov 23rd 2017, 11:29 |
neon1024 |
`$this->Form->control('date.date', ['type' => 'date']);` right? |
# |
Nov 23rd 2017, 11:29 |
neon1024 |
To me that’s bad form input naming |
# |
Nov 23rd 2017, 11:27 |
birdy247 |
File uploaded https://cakesf.slack.com/files/U0T295QA3/F85HL6Q1L/-.php / https://slack-files.com/T053DPNCM-F85HL6Q1L-5cbd0fcd38 |
# |
Nov 23rd 2017, 11:25 |
birdy247 |
but when i check the request getData its like [data[date]] = '01/01/2017' |
# |
Nov 23rd 2017, 11:25 |
birdy247 |
I am trying to post date[date] = '01/01/2017' |
# |
Nov 23rd 2017, 11:25 |
neon1024 |
Or just just a plain old `if ($this->request->is('post')) { Log::debug('Holy salmon fingers Batman!'); }` |
# |
Nov 23rd 2017, 11:25 |
birdy247 |
My problem is this |
# |
Nov 23rd 2017, 11:24 |
neon1024 |
Perhaps try a beforeSave or something |