# |
Aug 29th 2019, 20:15 |
ricksaccous |
i think the functions they provide are all agnostic i could be wrong though |
# |
Aug 29th 2019, 20:15 |
cnizzardini |
is DATE() a SQL standard...? |
# |
Aug 29th 2019, 20:15 |
cnizzardini |
so, i don't want to use a MySQL DATE cast, unless that is standard SQL... |
# |
Aug 29th 2019, 20:14 |
cnizzardini |
Yes, but the plugin is designed to be db agnostic |
# |
Aug 29th 2019, 20:14 |
ricksaccous |
yeah nvm lol |
# |
Aug 29th 2019, 20:14 |
ricksaccous |
hmmm maybe not |
# |
Aug 29th 2019, 20:14 |
ricksaccous |
might be able to do a datediff on a date |
# |
Aug 29th 2019, 20:13 |
ricksaccous |
https://book.cakephp.org/3.0/en/orm/query-builder.html#using-sql-functions |
# |
Aug 29th 2019, 20:13 |
jimbo2150 |
If you do a cast on the value within the database (not the value you are searching for) it should work - it should cast the database datetime to 00:00:00. |
# |
Aug 29th 2019, 20:13 |
cnizzardini |
Though your idea, is a tad more elegant than my plan b at least |
# |
Aug 29th 2019, 20:12 |
cnizzardini |
https://github.com/cnizzardini/cakephp-yummy |
# |
Aug 29th 2019, 20:12 |
cnizzardini |
Its to patch an issue in my plugin and that could be tricky :( |
# |
Aug 29th 2019, 20:11 |
cnizzardini |
Thanks Jim, I am hoping to avoid a ranged search |
# |
Aug 29th 2019, 20:11 |
ricksaccous |
you want exact match of date on day |
# |
Aug 29th 2019, 20:11 |
ricksaccous |
lol |
# |
Aug 29th 2019, 20:11 |
ricksaccous |
oh yeah i forgot about that |
# |
Aug 29th 2019, 20:11 |
cnizzardini |
yes |
# |
Aug 29th 2019, 20:11 |
yamcomnet |
I have also been working with vue and Cake. Would be interesting to know your approach. I have just used vue in views and passed json from controller and back |
# |
Aug 29th 2019, 20:11 |
jimbo2150 |
When you search for a single date (without time), most databases assume 00:00:00 as the time. Since that is not equal to 11:54:32 it will not find anything. You should do a between 2019-01-01 and 2019-01-02 (add a day to the end date). That will search for anything between 2019-01-01 00:00:00 and 2019-02-02 00:00:00. |
# |
Aug 29th 2019, 20:11 |
ricksaccous |
oh because it won't have a time? |
# |
Aug 29th 2019, 20:11 |
cnizzardini |
i dont think that will work |
# |
Aug 29th 2019, 20:10 |
ricksaccous |
or in the orm rather |
# |
Aug 29th 2019, 20:10 |
ricksaccous |
and plop that in the query |
# |
Aug 29th 2019, 20:10 |
ricksaccous |
and give it that date |
# |
Aug 29th 2019, 20:10 |
ricksaccous |
just create a date time object |
# |
Aug 29th 2019, 20:10 |
cnizzardini |
I actually need a means of doing this that is database engine agnostic |
# |
Aug 29th 2019, 20:09 |
cnizzardini |
or casting the column to DATE() for MySQL |
# |
Aug 29th 2019, 20:09 |
cnizzardini |
I was hoping there is a way of instructing cake to treat it as date field, rather than having to add a ranged search |
# |
Aug 29th 2019, 20:08 |
cnizzardini |
so if I have a record with a created value of '2019-01-01 11:54:32' and I search for created = '2019-01-01' obviously that will not return results |
# |
Aug 29th 2019, 20:05 |
ricksaccous |
are you talking about just displaying the date in that format? |
# |
Aug 29th 2019, 20:05 |
ricksaccous |
i don't understand exactly what you want |
# |
Aug 29th 2019, 20:03 |
cnizzardini |
I understand within the where operation I could probably cast to date with something like DATE(table_name.created) but is there another way to accomplish this? I'd like to avoid updating so much code. |
# |
Aug 29th 2019, 20:03 |
cnizzardini |
How do you tell the Cake ORM to treat a date/time field as a date field when doing like things like table_name.created = '2019-08-01' |
# |
Aug 29th 2019, 19:36 |
admad |
bakers pagination very large table might appreciate this https://github.com/cakephp/cakephp/pull/13572 |
# |
Aug 29th 2019, 18:11 |
sdevore |
Well maybe @bmudda tip will solve your problem for now…. |
# |
Aug 29th 2019, 18:04 |
noel |
I haven't quite figured out how to string them all together in a local env yet. |
# |
Aug 29th 2019, 18:03 |
noel |
I'm deploying to Docker containers but not using them for my local dev env, which is not ideal. |
# |
Aug 29th 2019, 18:02 |
sdevore |
Docker containers. So I kind of solve the whole it works on my machine issue by just having my machine everywhere ;) Mostly I can better replicate client environments with only a little extra overhead |
# |
Aug 29th 2019, 18:02 |
bmudda |
@noel your `phinx.yml` file should look like this if you are using MAMP ``` development: adapter: mysql host: localhost name: your_db_name user: your_db_user pass: 'your_db_password' unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock charset: utf8 ``` |
# |
Aug 29th 2019, 17:59 |
noel |
What do you use instead of MAMP now? |
# |
Aug 29th 2019, 17:58 |
sdevore |
this mamp stuff is from memory so could be *wrong* or *outdated* |