# |
Jul 5th 2018, 07:57 |
liaogz82 |
it is a mysql query |
# |
Jul 5th 2018, 07:56 |
slackebot4 |
sites, transactions where employees.id = transactions.employee_id and sites.id = transactions.site_id; ``` |
# |
Jul 5th 2018, 07:56 |
liaogz82 |
how to I translate this in the cakephp query form?? ``` select employees.pin_code, employees.name, DATE_FORMAT(transactions.created, '%d-%b-%Y') as date, DATE_FORMAT(transactions.created, '%H:%i') as time_in, DATE_FORMAT(transactions.modified, '%H:%i') as time_out, TIMEDIFF(DATE_FORMAT(transactions.modified, '%H:%i'), DATE_FORMAT(transactions.created, '%H:%i')) as time_worked, sites.name as site from employees, |
# |
Jul 5th 2018, 07:56 |
liaogz82 |
hi guys I need some help in the cakephp query |
# |
Jul 5th 2018, 00:48 |
ricksaccous |
it seems i needed to specify an array in the type method which shows up as deprecated... |
# |
Jul 5th 2018, 00:48 |
ricksaccous |
https://book.cakephp.org/3.0/en/controllers/request-response.html#dealing-with-content-types |
# |
Jul 5th 2018, 00:45 |
ricksaccous |
hmm that didn't seem to help |
# |
Jul 5th 2018, 00:42 |
ricksaccous |
text/csv |
# |
Jul 5th 2018, 00:42 |
ricksaccous |
csv/text instead |
# |
Jul 5th 2018, 00:42 |
ricksaccous |
actually it seems i should be using uhhh |
# |
Jul 5th 2018, 00:40 |
ricksaccous |
if I just do $response->type('csv') it seems to work... and change $response->getType(); to the proper type |
# |
Jul 5th 2018, 00:35 |
ricksaccous |
am i misunderstanding the function of withType? |
# |
Jul 5th 2018, 00:35 |
ricksaccous |
when i do $response->withType('csv'); and then $response->getType(); it still returns text/html |
# |
Jul 5th 2018, 00:34 |
ricksaccous |
I'm doing $reponse->getType(); and by default it's text/html |
# |
Jul 5th 2018, 00:34 |
ricksaccous |
in the use Cake\Http\Response class |
# |
Jul 5th 2018, 00:33 |
ricksaccous |
about to celebrate the 4th but i'm curious about something |
# |
Jul 4th 2018, 22:33 |
ojtibi |
@josbeir yes, but I found other core classes referring to `new CakeRequest()` by name. I doubt I can do a drop-in extended replacement for CakeRequest without modifying other files. Eg: `Object::requestAction()` has `new CakeRequest()` somewhere in its body. Unfortunately it's exactly requested actions and query strings I'm having problems with. I'm not sure if I can easily upgrade to the 2.9 series at the moment. |
# |
Jul 4th 2018, 21:08 |
michaelze |
@admad thanks for your help! Going to bed now ;) gn8! |
# |
Jul 4th 2018, 20:51 |
michaelze |
and essentially duplicate the code but not quite (validation vs. application rule) |
# |
Jul 4th 2018, 20:51 |
michaelze |
okay, so that means I also have to convert not empty or format (e.g. date) validations to application rules... |
# |
Jul 4th 2018, 20:50 |
admad |
"validation on create and application rule on edit" |
# |
Jul 4th 2018, 20:47 |
michaelze |
@admad thanks for your reply. Please see my latest comment on the question. The problem that I have now, is that the application rules don't execute until all the validations succeed... |
# |
Jul 4th 2018, 20:47 |
admad |
or validation on create and application rule on edit |
# |
Jul 4th 2018, 20:46 |
admad |
@michaelze you need to use application rule instead of validatoin |
# |
Jul 4th 2018, 18:55 |
michaelze |
I'm trying to solve a problem that I have regarding the interaction between validations and application rules. I already posted a question on stackoverflow (https://stackoverflow.com/questions/51124471/validate-against-not-edited-properties). I would really appreciate any input on that... Thx :slightly_smiling_face: |
# |
Jul 4th 2018, 16:44 |
flavius |
such confuse. |
# |
Jul 4th 2018, 16:44 |
flavius |
i always get it the 2nd or 3rd try myself, never the 1st try |
# |
Jul 4th 2018, 16:43 |
flavius |
heaven forbid you pluralize the model word to models, that wouldn't work either :P |
# |
Jul 4th 2018, 16:00 |
neon1024 |
Much confuse yo. |
# |
Jul 4th 2018, 16:00 |
neon1024 |
Seems I was looking for `$ bin/cake bake model all --no-fixture --no-test` |
# |
Jul 4th 2018, 15:58 |
neon1024 |
I mean it even says ‘BAKE. ALL. MODEL.’ and then bakes templates?! :shocked_face_with_exploding_head: |
# |
Jul 4th 2018, 15:58 |
neon1024 |
Seems it’s spreading to bake too |
# |
Jul 4th 2018, 15:57 |
neon1024 |
I tell you, bin/cake has gone down the shitter in the last few releases |
# |
Jul 4th 2018, 15:57 |
neon1024 |
:face_with_rolling_eyes: |
# |
Jul 4th 2018, 15:57 |
neon1024 |
Right |
# |
Jul 4th 2018, 15:57 |
neon1024 |
Ah, and then it bakes all the templates as well anyway despite me specifying a model |
# |
Jul 4th 2018, 15:56 |
neon1024 |
That just lists models and makes me pick |
# |
Jul 4th 2018, 15:56 |
neon1024 |
I thought that it was this, `$ bin/cake bake all model` but it isn’t |
# |
Jul 4th 2018, 15:56 |
neon1024 |
Can I bake all the models and entities at once? I don’t want controllers or templates though |
# |
Jul 4th 2018, 15:41 |
james.phillips |
I might put them into routes....but its just a loop so bit messy |
# |
Jul 4th 2018, 15:41 |
james.phillips |
so am I at the moment... |