Log message #4221664

# At Username Text
# Jan 8th 2020, 13:03 ashish_onmobile ```public function initialize(): void { parent::initialize(); $this->loadComponent('RequestHandler'); $this->loadComponent('Crud.Crud', [ 'actions' => [ 'Crud.Index', 'Crud.View', 'Crud.Add', 'Crud.Edit', 'Crud.Delete' ], 'listeners' => [
# Jan 8th 2020, 13:02 ashish_onmobile I am working on cakephp 4.x and using friendsofcake crud 6.0.0-beta
# Jan 8th 2020, 13:02 ashish_onmobile Hi All
# Jan 8th 2020, 12:58 admad the arguments of `combine()` can be a callable instead of string
# Jan 8th 2020, 12:55 jmmonty I’ll give that a whirl now - appreciate it
# Jan 8th 2020, 12:55 admad check the docs/api :)
# Jan 8th 2020, 12:54 jmmonty @admad That’s awesome thank you. Can the combine take more elements, using the first as the key?
# Jan 8th 2020, 12:54 admad or `->toArray()` instead of `toList()`
# Jan 8th 2020, 12:54 admad @jmmonty `collection($array)->combine('emai', 'name')->toList()`
# Jan 8th 2020, 12:51 slackebot `'email' => 'john@example.com'` `],` `[` `'name' => 'Jane',` `'department' => 'Marketing',` `'email' => 'jane@example.com'` `],` `[` `'name' => 'Dave',` `'department' => 'Marketing',` `'email' => 'dave@example.com'` `],` `])->map(function ($employee) {` `return [$employee['email'], $employee['name']];` `})->toAssoc();`
# Jan 8th 2020, 12:51 jmmonty Hello all - could anyone help using the Cakephp Collections class to create a new collection using a field as the new key? I’ve tried with map and a few our approaches and can do most things, other than set the new collections keys. Here’s an Lavarel example by Adam Wathan which is pretty much what I’m trying to do - thanks in advance. `$emailLookup = collect([` `[` `'name' => 'John',` `'department' => 'Sales',`
# Jan 8th 2020, 12:49 jotpe My guess is, that you have another route '/' which matches first
# Jan 8th 2020, 12:48 jotpe Commenting the path out is the same as setting it to '/': https://api.cakephp.org/3.4/source-class-Cake.Routing.Router.html#1031
# Jan 8th 2020, 12:46 damiano how is that possible?
# Jan 8th 2020, 12:46 damiano if i use the 'path' it s works....if i set it to / or just comment it no works
# Jan 8th 2020, 12:46 damiano in Plugin.php
# Jan 8th 2020, 12:46 damiano `public function routes(RouteBuilder $routes): void` `{` `$routes->plugin(` `'Webhook',` `[/*'path' => '/web',*/],` `function (RouteBuilder $builder) {` `// Add custom routes here` `$builder->connect('/{controller}/{action}/*', [])->setHost('test.localhost');` `}` `);` `parent::routes($routes);` `}`
# Jan 8th 2020, 12:45 damiano i have this:
# Jan 8th 2020, 12:42 damiano @jopt
# Jan 8th 2020, 12:41 damiano @jotpe yes but without custom host
# Jan 8th 2020, 12:21 admad even in 4.x its tricky since the mail renderer using `View` class and decoupling it would be non trivial
# Jan 8th 2020, 12:20 val @admad :( that would not make it easier to migrate from 2.x
# Jan 8th 2020, 12:20 conehead Ah found a sweet little bug in Text::excerpt
# Jan 8th 2020, 12:19 jotpe Thanks, @noel
# Jan 8th 2020, 12:19 admad it's unlikely 3.x will have any new split packages, but it might be doable for 4.x
# Jan 8th 2020, 12:18 val Hi, would it be possible to publish 3.x Mailer code as a separate package? Like https://github.com/cakephp/utility
# Jan 8th 2020, 12:18 jotpe Ay, this works :+1:
# Jan 8th 2020, 12:17 conehead Can you try: ```$addressTable->newEntity(['country' => 276], ['validate' => false]);```
# Jan 8th 2020, 12:17 conehead Ah
# Jan 8th 2020, 12:15 slackebot <jotpe>
# Jan 8th 2020, 12:14 jotpe It's this part:
# Jan 8th 2020, 12:11 jotpe https://gist.github.com/julianpollmann/64fe2ea24e13d736400a321978637e67
# Jan 8th 2020, 12:11 conehead Shouldnt it be possible to skip the validation for get requests?
# Jan 8th 2020, 12:09 jotpe For the Registration data the fields are not validated, for InvoiceAddress it does
# Jan 8th 2020, 12:08 jotpe But It's associated data. Association looks like: Registrrations->Invoices->InvoiceAddresses
# Jan 8th 2020, 12:08 jotpe And I'm not in the post section
# Jan 8th 2020, 12:08 jotpe It's get
# Jan 8th 2020, 12:08 conehead Do you open the form via get or post?
# Jan 8th 2020, 12:07 conehead But shouldnt the validation only trigger when you post some data?
# Jan 8th 2020, 12:07 conehead Well you could add a flag if the validation should be skipped
# Jan 8th 2020, 12:00 jotpe Btw. You can leave out the path option, if it's '/'