Logs for #cakephp

Page 1 of 36,469, showing 100 records out of 3,646,803 total, starting on record 1, ending on 100

# At Username Text
# Yesterday, 21:29 jimbo2150 Yes, MySQL will rewrite that query to `ALTER TABLE \`results\` CHANGE \`status\` \`status\` TINYINT(1) UNSIGNED NULL;` and when you query for the column types is comes out as `TINYINT(1)` so there is no way for CakePHP (or any code) to even detect a `TINYINT(1)` vs `BOOLEAN`.
# Yesterday, 21:19 wizardfix So are the SQL statements generated by phpMyAdmin just syntactic sugar? ```ALTER TABLE `results` CHANGE `status` `status` BOOLEAN UNSIGNED NULL;```
# Yesterday, 21:16 jimbo2150 Once it is removed it will just be `TINYINT` (without parentheses) unless they implement `BOOLEAN` as a separate type. In the first case it will be up to the code to cast it as boolean either in the SELECT query or once it's returned the value as an integer (e.g. greater than 0 is true otherwise false).
# Yesterday, 21:15 ndm I'm not familiar with the future plans for MySQL, but I'd suspect that they will add a real boolean type then
# Yesterday, 21:14 ndm *Until
# Yesterday, 21:14 ndm Unless it's actually removed, sure
# Yesterday, 21:12 wizardfix @ndm I didn't realise display width was deprecated - I see now it's deprecated for integer types from 8.0.17 - but that raises the question of - will `TINYINT(1)` still be interpreted as `BOOLEAN` ...
# Yesterday, 21:06 jimbo2150 @ndm so it is.. I rarely ever use them outside of floats and strings anyway.
# Yesterday, 21:06 wizardfix @ndm iI
# Yesterday, 21:04 ndm Well, it is what it is :) Display width is deprecated anyways, and there's no reason to use it unless the application that reads the data uses it for a specific purpose, like CakePHP does, to identify possible boolean types. Since boolean is a synonym, you'll receive tinyint(1) when reading the column details, ie there's no other way for CakePHP to "emulate" boolean types
# Yesterday, 20:59 wizardfix Afaik, in all other cases changing the integer in parentheses just changes the display width. In this case changing it from any integer `>1` to `1` changes its type and its inherent nature. :thinking_face:
# Yesterday, 20:57 wizardfix Ha! Was looking at that page before... Yeah I see the reference: > `BOOL`, `BOOLEAN` > These types are synonyms for `TINYINT(1)`. A value of zero is considered false. Nonzero values are considered true: but I find it unintuitive.
# Yesterday, 20:49 ndm boolean is a synonym for tinyint(1)
# Yesterday, 20:49 ndm https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
# Yesterday, 20:45 wizardfix @jimbo2150 @admad I can find *nothing at all* in the MySQL docs saying `TINTINT(1)` is treated as a Boolean. And in my phpMyAdmin, it lets me change a field to Boolean, and generates this SQL statement: ```ALTER TABLE `results` CHANGE `status` `status` BOOLEAN UNSIGNED NULL DEFAULT TRUE;``` thus seeming to support Booleans... I'm trying to understand this! :)
# Yesterday, 20:01 wizardfix so logically I expected `TINYINT(1)` to be able to store any integer in `[0, 1, 2, ... ,8, 9]`...
# Yesterday, 19:57 ndm Ackchyually the number in parentheses _is_ the display width. The number of bytes an integer type can store is defined by the type of the integer, ie tinyint, smallint, mediumint, int, bigint
# Yesterday, 19:52 wizardfix Ha! The :bug: was in my understanding of MySQL! x) So I've learnt something and got my method working. Win-win! :)
# Yesterday, 19:51 jimbo2150 The number in the parentheses is the maximum number of bytes stored in the field, not the number of characters.
# Yesterday, 19:49 admad tinyint(1) is the only way to emulate boolean in mysql since it's lacks "real" boolean type like other dbs
# Yesterday, 19:36 wizardfix @jimbo2150 thanks but u=is
# Yesterday, 19:34 jimbo2150 @wizardfix In MySQL, `BOOLEAN` is a synonym for `TINYINT(1)`. Your options are to set it to `TINYINT(2)` or overwrite the column type in CakePHP 3+: https://stackoverflow.com/questions/10801632/cakephp-and-tinyint-as-boolean
# Yesterday, 19:17 lpj145 what your think about repository pattern on cakephp ?
# Yesterday, 19:16 lpj145 guy's, i hope your are so fine...
# Yesterday, 19:16 wizardfix Is this a bug? Spent hours with my brain frying wondering why Cake 3.8 refused to update a row in my database. Eventually realised it was treating my `TINYINT(1) UNSIGNED DEFAULT 1` field as a Boolean. The moment I changed it to `TINYINT(2)` everything worked. :thinking_face:
# Yesterday, 02:24 markstory @neon1024 I’m actually working on making debug() better, and enable better formatting for CLI and HTML output. JSON is tricky though as you can’t really output more than one ‘thing’
# Jan 17th, 13:40 storkovo and the hell of loop errors is gone
# Jan 17th, 13:34 admad you will get json response for exceptions, not for errors
# Jan 17th, 13:29 neon1024 I thought Exception Renderer too, guess I need to build one
# Jan 17th, 13:28 neon1024 So what the content-type is becomes irrelevant
# Jan 17th, 13:28 neon1024 I think the error handler is spitting this out before the response is composed
# Jan 17th, 13:28 neon1024 As the response type is correct
# Jan 17th, 13:28 neon1024 I think there is an issue with the api
# Jan 17th, 13:28 spriz Yeah but it looks good now, doesn't it? ;P
# Jan 17th, 13:27 neon1024 @spriz Preview shows HTML as well
# Jan 17th, 13:18 spriz but I've done it with an exceptionRenderer
# Jan 17th, 13:17 spriz @neon1024 Change the tab to `preview` and it's good ;P
# Jan 17th, 12:18 neon1024 …so that errors are more readable than this
# Jan 17th, 12:18 neon1024 Anyone know if there is a simple way to have requests sent as application/json throw errors as json?
# Jan 17th, 12:04 challgren Well first is your flash even working?
# Jan 17th, 11:57 challgren like bootstrap-ui?
# Jan 17th, 11:56 challgren Do you have anything override the flashhelper?
# Jan 17th, 11:56 alexdd55976 nope... no changes.
# Jan 17th, 11:54 dereuromark ctp => php as well for cake4
# Jan 17th, 11:53 alexdd55976 @challgren this is what i looked into
# Jan 17th, 11:52 alexdd55976 @javier.villanueva nope nothing.
# Jan 17th, 11:10 challgren I think it would be in /templates/element/flash https://github.com/cakephp/app/tree/master/templates/element/flash
# Jan 17th, 11:04 javier.villanueva Because if you have any plugin that override Elements/Flash folder
# Jan 17th, 11:02 javier.villanueva Do you use any template?
# Jan 17th, 10:10 alexdd55976 thats right
# Jan 17th, 10:09 neon1024 Perhaps you’re in 4.x?
# Jan 17th, 10:07 alexdd55976 @neon1024 > Should be in the Elements/Flash folder > Then the Flash->success() would use success.ctp
# Jan 17th, 08:43 javier.villanueva anyway I use devexpress and I must migrate these lists to it
# Jan 17th, 08:43 javier.villanueva yes... my bake limit to 200... it's a pending task to change it :_ D
# Jan 17th, 08:36 neon1024 Was there ever a plan for an offset paginator component?
# Jan 17th, 08:36 neon1024 Yeah and bake now limits to 100 on baked code too
# Jan 17th, 08:32 javier.villanueva thanks
# Jan 17th, 08:32 javier.villanueva ok, i will try
# Jan 17th, 08:31 spriz but you can change that component in eg. the AppController
# Jan 17th, 08:31 spriz AFAIK the `Paginator` defaults to `100` in `maxLimit` :thinking_face:
# Jan 17th, 08:31 javier.villanueva @spriz 3.8
# Jan 17th, 08:30 spriz is it 3.x or 4.x @javier.villanueva?
# Jan 17th, 08:24 javier.villanueva I must set in paginate, 'maxLimit' => 10000 .... but... Is there any way to set it unlimited for the entire project?
# Jan 17th, 08:21 javier.villanueva my error...
# Jan 17th, 08:11 javier.villanueva not works
# Jan 17th, 08:10 d.lisiecki93 @javier.villanueva try `->limit(9999)` on query object
# Jan 17th, 08:09 javier.villanueva One question.... I have a table with 1300 records. When I find by default, I get 100 rows... :thinking_face: How to can I change this limit? (to unlimited)
# Jan 17th, 07:32 neon1024 Then the Flash->success() would use success.ctp
# Jan 17th, 07:31 neon1024 Should be in the Elements/Flash folder
# Jan 17th, 07:30 alexdd55976 fellows, i struggle with modifying the flash message. the elements in templates seems like they are not beeing used. do not really know where to make changes
# Jan 17th, 07:22 neon1024 A very merry Friday to all
# Jan 17th, 07:18 javier.villanueva morning all
# Jan 17th, 06:58 d.lisiecki93 @admad oh sorry
# Jan 17th, 06:47 alexdd55976 morning
# Jan 17th, 06:42 admad don't use threads
# Jan 17th, 06:41 d.lisiecki93 thank You
# Jan 17th, 06:36 admad it's secure only if you use form `order('field' => $userInput)`
# Jan 17th, 06:33 d.lisiecki93 hello fellas, is it secure to pass user input without any escaping to `->order` method on table object? something like this: ```$userInput = $this->request->getQuery('order'); $this->Model->find('all')->order($userInput);```
# Jan 16th, 23:14 challgren Myself personally I just use the php functions directly]
# Jan 16th, 23:13 challgren Well I can say in 4.x they are deprecated and set to be removed in 5.x
# Jan 16th, 23:06 wizardfix I'm trying to use framework functions as documented here: https://book.cakephp.org/3/en/core-libraries/file-folder.html
# Jan 16th, 23:01 challgren Ohh sorry, https://www.php.net/manual/en/function.file-put-contents.php?
# Jan 16th, 23:00 wizardfix @challgren I'm on 3.8...not looking for a plugin,, just want to write text to a file! :)
# Jan 16th, 22:57 challgren I think only https://github.com/josbeir/cakephp-filesystem supports 4.x
# Jan 16th, 22:57 challgren @wizardfix check https://github.com/friendsofcake/awesome-cakephp for ones with :strawberry:
# Jan 16th, 22:03 wizardfix *Problem creating and writing to file* This is probably something simple I'm missing. I'm just trying to create a file and write a line of text to it. ```$path = WWW_ROOT . 'files/test_results_ex.csv'; $file = new File($path, true, 0755); $file->write('#ID,Number,Country,Start time,Connect time,End time,Score,URL'); $file->close();```
# Jan 16th, 21:26 ricksaccous is there a fileuploader plugin out there for cakephp4?
# Jan 16th, 20:02 ndm @noel JSON column types are handles by the JSON database types, which encodes/decodes the data accordingly when reading/writing from/to the database. https://github.com/cakephp/cakephp/blob/3.8.8/src/Database/Type/JsonType.php
# Jan 16th, 19:15 noel Actually that's not going to help me.. the value is already incorrectly stored within the entity's `_properties`. So I think the problem is at the point where the query is executed and the entity's properties are hydrated.
# Jan 16th, 18:54 noel Or should I create my own datatype instead?
# Jan 16th, 18:51 slackebot How can I affect this? I want to somehow intercept or overwrite the getter?
# Jan 16th, 18:51 noel So.. the problem I'm having actually seems to be with the entity's getters. The property I'm interested in was defined in the migration as a `json` data type. The value stored in the database is `{"AO":{}}` but the entity defines the property as an array (i.e. `@property array`) and the getter returns the value as `["AO" => []]` as a PHP array structure. Presumably it is performing a `json_decode` in the getter due to the data type of the field.
# Jan 16th, 18:41 jimbo2150 Hm, I don't see much difference with the dependencies with that package. I prefer not to try to revert back to dev for packages as 4 continues shifting over to stable packages. It is not affecting anything major, just wondering if anyone else was seeing that issue. Thanks @challgren
# Jan 16th, 18:41 noel Wish I'd found this comment about 2 days ago: `// JSON API as generated by NeoMerx. When things look off, start debugging here`
# Jan 16th, 18:28 challgren But if I switch it back to ^4.0 it does the upgrade and then downgrade
# Jan 16th, 18:27 challgren But I am using a dev debugkit version
# Jan 16th, 18:27 challgren @jimbo2150 doesn’t happen on my project today
# Jan 16th, 18:21 jimbo2150 Happened again, upgrading then downgrading again with Composer with default CakePHP 4 setup. Still not sure what is going on...
# Jan 16th, 18:20 noel I think the problem I'm having is to with the Entity. So my viewVar contains an entity. If I do a get on the property I want from the entity it is returning an incorrect value. It's confusing because as I understand it crud-json-api is supposed to get it's data from the BodyParserMiddleware... but I don't think it's doing that. I think instead it is getting it from the entity.
# Jan 16th, 18:19 challgren Ughh I have to learn lararel I fought tooth and nail to use CakePHP