Log message #4186390

# At Username Text
# May 15th 2019, 11:53 admad i would open an issue with rector to stop messing up the code for no reason
# May 15th 2019, 11:52 spriz they change all `Foo::bar` to `(new Foo)->bar`
# May 15th 2019, 11:52 admad that's silly
# May 15th 2019, 11:52 spriz Yeah, but my concern is that the rector tool with php70, php71, php72 and php73 levels are changing that piece of code for some reason
# May 15th 2019, 11:50 admad you shouldn't be doing `(new Text())->uuid()` infact, it's a static method
# May 15th 2019, 11:49 admad @spriz static for utility functions are just fine
# May 15th 2019, 11:49 Mikeynl ok, anyone can point me out where to get some help on my question ?
# May 15th 2019, 11:47 dereuromark @neothermic I kind of hoped to get a more toArrayRecursive() kind of thing here somehow.
# May 15th 2019, 11:44 spriz Those 2 appear the same to me, just with a different syntax with harder-to-read use of parentheses
# May 15th 2019, 11:43 spriz rather than just having `$newFileName = Text::uuid() . '.' . $extension;`
# May 15th 2019, 11:42 spriz but I am still not really following the hate on all static calls to be honest :) `$newFileName = (new Text())->uuid() . '.' . $extension;` seems weird to be
# May 15th 2019, 11:40 spriz makes sense :slightly_smiling_face:
# May 15th 2019, 11:40 spriz Ah now we're talking - I did not see that trait mentioned before.
# May 15th 2019, 11:40 admad then do `$this->getTableLocator()->get()`
# May 15th 2019, 11:39 admad instead your class should use the `LocatorAwareTrait`
# May 15th 2019, 11:39 admad @spriz IMO using `TableRegistry::getTableLocator()->get()` instead of `TableRegistry::get()` is no improvement. You are still using the table registry and static call.
# May 15th 2019, 11:36 spriz Aha :thinking_face: From what I see in the book they still use `TableRegistry::getTableLocator()->get()` in there :cold_sweat:
# May 15th 2019, 11:21 neon1024 There is a very long issue, if I recall with discussion around the topic
# May 15th 2019, 11:20 neon1024 @spriz I *think* this is due to the core team renaming the TableRegistry essentially, so it’s been deprecated
# May 15th 2019, 11:19 Mikeynl feeling it doesnt touch the CakePdf view at all
# May 15th 2019, 11:18 spriz I mean, when there is no side effects, why the big hate? :)
# May 15th 2019, 11:16 spriz rector is really not happy about static classes eh :thinking_face: ``` - $config = TableRegistry::getTableLocator()->exists('Users') ? [] : ['className' => UsersTable::class]; + $config = (new TableRegistry())->getTableLocator()->exists('Users') ? [] : ['className' => UsersTable::class]; ```
# May 15th 2019, 11:16 Mikeynl but doesnt render at all
# May 15th 2019, 11:14 Mikeynl nevermind last one, it got application/pdf
# May 15th 2019, 11:13 Mikeynl response type stays text/html
# May 15th 2019, 11:12 Mikeynl anu suggestion, have cakepdf installed, see in RequestHandlerComponent that viewClassMap -> "pdf" => "CakePdf.Pdf" is registered, but have feeling doesnt render at all
# May 15th 2019, 11:07 neothermic @dereuromark the super hacky way is to convert it back to JSON and back out to an array with the second param of json_decode :P
# May 15th 2019, 10:51 dereuromark If I return a Json response from a collection (index), the items are not toArray() but actual objects in the json. Is there a good way to make them pure arrays?
# May 15th 2019, 10:21 kiwi_45 Thanks very much, looks a good method
# May 15th 2019, 10:19 dereuromark The 4.x branch should also work afaik.
# May 15th 2019, 10:18 dereuromark I recommend using such a component approach instead of island things and inconsistent checking all over the code.
# May 15th 2019, 10:18 dereuromark I use https://github.com/dereuromark/cakephp-tools/blob/master/src/Controller/Component/CommonComponent.php#L23 to fix up the incoming data for trim requirement.
# May 15th 2019, 10:16 kiwi_45 What's the recommended way of modifying POST data in CakePHP 4?
# May 15th 2019, 10:16 kiwi_45 $this->request->data['username'] = trim($this->request->getData('username'));
# May 15th 2019, 10:16 kiwi_45 I'd like to modify request data directly, but my approach (below) is deprecated:
# May 15th 2019, 09:24 np Hello - /users/login via app ```{ "message": "Missing CSRF token cookie", "url": "/users/login", "code": 403, "file": "/app/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php", "line": 196 }``` How to fix?
# May 15th 2019, 08:08 neon1024 Morning all :wave:
# May 15th 2019, 07:47 cosmin.cimpoi @marcusgoede Cake should do all this for you. I would guess it s something in configs, maybe localization
# May 15th 2019, 07:32 marcusgoede Hi everybody, I’ve installed CRUD for a new CakePHP app. It works basically fine, but I have one problem: Crud view automatically creates datetime pickers for datetime fields. When I submit the datetime format is wrong: *Invalid datetime format: 1292 Incorrect datetime value: ‘16.05.2019 00:00’* Is there a way to change submitted datetime values to be compatible for the database?
# May 15th 2019, 06:44 Mikeynl someone has some time to help me to debug routes ? I installed Cakepdf plugin, but the view render is not working. Spitting out plain html
# May 15th 2019, 02:54 waspinator does patchEntity take `_joinData` into considerations when processing `belongsToMany` data? I want to add two relationships with the same `foreignKey` and `targetForeignKey`, but with different `_joinData`