Log message #4265874

# At Username Text
# Jun 19th 2021, 20:50 kevin.pfeifer so like the outputted `$entity->created` datetime in your frontend didn’t change?
# Jun 19th 2021, 20:46 alamnaryab I wrote this at end of bootstrap.php ``` Time::setToStringFormat('HH:mm:ss'); FrozenTime::setToStringFormat('HH:mm:ss'); Date::setToStringFormat('yyyy-MM-dd HH:mm:ss'); FrozenDate::setToStringFormat('yyyy-MM-dd HH:mm:ss'); ``` but still date from database is showing like `2015-09-26T18:58:40+04:00`
# Jun 19th 2021, 20:30 kevin.pfeifer but be aware if you want to set the date format yourself (not using the preconfigured constants) with something like `'Y-m-d H:i:s'` because these “letters” are not your typically PHP date variables. Instead this is used here: http://userguide.icu-project.org/formatparse/datetime
# Jun 19th 2021, 20:25 kevin.pfeifer this should be added to your `config/bootstrap.php` at the bottom
# Jun 19th 2021, 20:23 kevin.pfeifer https://book.cakephp.org/4/en/core-libraries/time.html#setting-the-default-locale-and-format-string
# Jun 19th 2021, 20:15 alamnaryab Using Cakephp 4 what is better way to change dateformat, datetimeformat at project level?
# Jun 19th 2021, 18:51 admad yes
# Jun 19th 2021, 18:46 angelxmoreno @admad did i get that right ?
# Jun 19th 2021, 18:46 angelxmoreno @kupe3b the issue is for the instructions being bad. You should still have `$this->addPlugin('Authentication');` in your Application.php file.
# Jun 19th 2021, 03:14 admad You should open an issue on the repo.
# Jun 19th 2021, 03:13 admad No
# Jun 19th 2021, 03:13 kupe3b so i dont need to add anything in bootstrap.php?
# Jun 19th 2021, 03:12 admad @kupe3b those docs are outdated.
# Jun 19th 2021, 01:41 kupe3b if i type `bin/cake plugin load pluginname` it adds `$this->addPlugin('Authentication');` in Application.php, but reading the CakeDC Users plugin i see beside addPlugin in Application.pht it also instructs adding ` ```Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);``` in bootstrap.php so i'm cofused. why do i have to add plugin twice? what is this needed?
# Jun 18th 2021, 20:35 japerlman it's because my fields are pascalCase it looks, I made a new table in all lower case and it works perfectly
# Jun 18th 2021, 19:42 japerlman PATCH url of http://x.x.x.x/roles/3
# Jun 18th 2021, 19:42 japerlman ```{ "data": { "type": "roles", "id": "3", "attributes": { "roleDescription": "My new name" } } }```
# Jun 18th 2021, 19:41 japerlman I have the json api accepting my PATCH requests now and it's returning a '200' but it's not actually updating the field in the DB with the new value, any thoughts? I've looked through the docs at https://crud-json-api.readthedocs.io/en/latest/ a few times now and it seems like my json data is valid/correct.
# Jun 18th 2021, 18:49 kevin.pfeifer well if you are happy with a search result like neon1024 explained above sure, go for that
# Jun 18th 2021, 18:40 alamnaryab @admad this datatype specification worked as I am dynamically populating conditions array, so I have made every fields string.
# Jun 18th 2021, 15:29 japerlman ok nevermind, now all my responses are blank but I'm still getting a 200 OK
# Jun 18th 2021, 15:12 slackebot1 JSON/CRUD listener so I'm not sure at all where the redirect is being defined.
# Jun 18th 2021, 15:12 japerlman I have a clean cake 4 project using the friends of cake crud plugin and the json plugin to go with it. I have the json GET requests working correctly and I'm testing my PATCH for the 'edit' action and its redirecting me back to 'index' and saying the object was updated but when I look at the object again the changes aren't there. I'm not sure why it's redirecting, I don't have any controller defined at all and just using the
# Jun 18th 2021, 12:47 admad https://api.cakephp.org/4.2/class-Cake.Database.Query.html#where()
# Jun 18th 2021, 12:46 admad `->where($conds, ['id' => 'string'])`
# Jun 18th 2021, 12:30 alamnaryab for now I managed by making an array of `int` type fields, and then inside loop `if(in_array($cols[$i],$int_typed_fileds_array))` ....
# Jun 18th 2021, 12:25 alamnaryab I am making `$conds` as below ``` $conds = []; if ( isset($qs['sSearch']) andand $qs['sSearch'] != "" ) { for ( $i=0 ; $i<count($cols) ; $i++ ) { $conds[$cols[$i]." LIKE"]="%".$qs['sSearch']."%"; } }```
# Jun 18th 2021, 12:20 kevin.pfeifer yes, but Fakhr Alam wants to set these filters dynamically and therefore tried to just make it all work with a generic ```'%field% LIKE' => '%value%', ``` which e.g. doesn’t work for integer fields
# Jun 18th 2021, 12:19 erwane I'm pretty sure the id filter should be an `=` not a `LIKE`
# Jun 18th 2021, 12:14 kevin.pfeifer @neon1024 the fact, that you didn’t continue your sequence with `101` hurt me a little…
# Jun 18th 2021, 12:07 neon1024 So if I queried for `id = 1` I would get `1`, `10`, `11`, `100`, `11011`. It’s a curious way to filter
# Jun 18th 2021, 12:05 alamnaryab because I want to do server side coding for jquery datatable filter, to check the term in all feilds
# Jun 18th 2021, 12:02 erwane if your column id is `int` why using like ?
# Jun 18th 2021, 11:23 kevin.pfeifer then I would exclude certain columns (like the id field when you have a string search param) from that search depending on what is the given search parameter type.
# Jun 18th 2021, 11:20 alamnaryab here I posted only 2 fields actually it is dynamic term to be checked in all fields of table. same as datatable search
# Jun 18th 2021, 11:15 kevin.pfeifer @alamnaryab do you really want to query the `id` column with a `LIKE`?
# Jun 18th 2021, 11:13 alamnaryab Hi All using cakephp 4.2.2 getting below error `Cannot convert value of type `string` to integer` ```$conds = [ 'id LIKE' => '%a%', //int field 'name LIKE' => '%a%', //varchar field ]; $conds= ['OR'=>$conds]; $query = $this->Students->find('all') ->where($conds) ->select($cols); $data = $this->paginate($query);```
# Jun 18th 2021, 11:08 neon1024 Hopefully shouldn’t need a template
# Jun 18th 2021, 11:08 neon1024 Yeah, I am implementing some OAuth, so just trying to get my head around the flow at the moment
# Jun 18th 2021, 11:07 kevin.pfeifer @neon1024 just FYI: If you manually return a response inside your action then you don't need to do that (like when returning ajax directly)
# Jun 18th 2021, 11:06 neon1024 Ace, thanks @kevin.pfeifer