Logs for #cakephp

Page 15 of 36,922, showing 100 records out of 3,692,143 total, starting on record 1,401, ending on 1,500

# At Username Text
# Jul 6th 2021, 09:52 paolo.bragagni how to send back the data saved (with the primaryKey and the other data?
# Jul 6th 2021, 09:51 paolo.bragagni when I save in this way $this->Lingue->save($lingua)
# Jul 6th 2021, 09:51 paolo.bragagni I have to send back via json the data saved
# Jul 6th 2021, 09:37 paolo.bragagni it works sorry
# Jul 6th 2021, 09:31 paolo.bragagni (I'm creating a bake template)
# Jul 6th 2021, 09:31 dereuromark but your approach should still work as well - see live https://sandbox.dereuromark.de/sandbox/ajax-examples/form working example.
# Jul 6th 2021, 09:31 paolo.bragagni the 'id'=>'addlingue' doesnt works in cake4
# Jul 6th 2021, 09:30 dereuromark depends on how many fields maybe for only 1-2 it could also be manual, e.g. var selectedValue = $(this).val(); var targeturl = $(this).attr('rel') + '?id=' + selectedValue;
# Jul 6th 2021, 09:27 paolo.bragagni data: $("#addlingue" ).serialize()
# Jul 6th 2021, 09:27 paolo.bragagni and when I clicked to submit I called the controlled via ajax whit
# Jul 6th 2021, 09:24 paolo.bragagni <?php echo $this->Form->create('Lingua',array('id'=>'addlingue','novalidate' => true,'url' => false, 'method' => false)); ?>
# Jul 6th 2021, 09:24 paolo.bragagni In my old cake2 project I used to create the form in this way
# Jul 6th 2021, 09:23 paolo.bragagni how to send form data via ajax to a specific controller?
# Jul 6th 2021, 06:21 kevin.pfeifer ok, I think my problem was just, that I believed the default was set to false and I had to manually enable e.g. routes (maybe this was how it was handled in the past)
# Jul 6th 2021, 06:18 admad You can then override it through the option in `addPlugin()`, for e.g. if a plugin has routes enabled but you don't need them you can use `'routes' => false` when adding
# Jul 6th 2021, 06:18 lzz Ok, the testCsrfAppliedOk() was missing enableSecurityToken().
# Jul 6th 2021, 06:17 kevin.pfeifer alright, thx :+1:
# Jul 6th 2021, 06:16 admad Right
# Jul 6th 2021, 06:14 kevin.pfeifer sure, but the default for all these variables is set to true https://github.com/cakephp/cakephp/blob/master/src/Core/BasePlugin.php#L37 So all properties, which I don’t need, should be set to false inside my Plugin.php
# Jul 6th 2021, 05:39 lzz Hello. After enabling Authorization in my cakephp baked code, I have some tests failing in the baked PagesControllerTest.php. testMissingTemplate() returns 500 even though the first line in display() is the skipAuthorization() call. Opening from the webbrowser I correctly get the MissingTemplateException. Also, testCsrfAppliedOk() is returning 400 and logging that _Token was not found in request data. But the enableCsrfToken() line
# Jul 6th 2021, 05:39 slackebot2 is there.
# Jul 6th 2021, 05:30 admad @kevin.pfeifer those properties set the default. For e.g. no point having routes hook enabled if your plugin doesn't set any routes.
# Jul 5th 2021, 20:30 kevin.pfeifer otherwise you could always create a virtual field if you don’t need to query it https://book.cakephp.org/4/en/orm/entities.html#creating-virtual-fields
# Jul 5th 2021, 20:23 slackebot2 'Roles.name' // or whatever the column field is for the name of the role ] ] ); }```
# Jul 5th 2021, 20:23 kevin.pfeifer looking at https://book.cakephp.org/4/en/orm/retrieving-data-and-resultsets.html#eager-loading-associations-via-contain I would guess something like ```public function findForAuthentication(\Cake\ORM\Query $query, array $options): \Cake\ORM\Query { return $query->contain( [ 'Staffs', 'Students', 'StudentParents', 'UserRoles.Roles' => [
# Jul 5th 2021, 19:59 alamnaryab How can I get plain array of role-names in above Finder
# Jul 5th 2021, 19:58 alamnaryab hi I am using custom Finder to get contained model on Authentication.login ```public function findForAuthentication(\Cake\ORM\Query $query, array $options): \Cake\ORM\Query { return $query->contain( [ 'Staffs', 'Students', 'StudentParents', 'UserRoles.Roles' ] ); }``` `UserRoles.Roles` is giving `Roles` inside
# Jul 5th 2021, 19:58 slackebot2 `UserRoles` objects while I want simple array or roles as `['admin','super-admin']` because in my project I have used `in_array('admin',$this->Auth->roles() ){ ... }` and ``array_intersect(['admin','role2'],$this->Auth->roles() ){ ... }`
# Jul 5th 2021, 19:20 kevin.pfeifer But I guess setting those variables in my Plugin.php is recommended for the future?
# Jul 5th 2021, 19:19 kevin.pfeifer Okay i just looked at the constructor of the BasePlugin class and it basically sets those variables
# Jul 5th 2021, 19:15 kevin.pfeifer or is this something different?
# Jul 5th 2021, 19:15 kevin.pfeifer I noticed protected variables in in the BasePlugin class like `$bootstrapEnabled` or `$routesEnabled` which are all true. So are those the “new” recommended way to enable/disable plugin parts like routes instead of ```$this->addPlugin( 'MyPlugin', [ 'routes' => true ] ); ```
# Jul 5th 2021, 16:45 dereuromark Also improvements/PRs are welcome
# Jul 5th 2021, 16:44 dereuromark Anyone using the Queue plugin and wants to test the new v6 before I tag a stable release on it ( https://github.com/dereuromark/cakephp-queue/releases )?
# Jul 5th 2021, 14:54 jotpe Okay, got it. For some reasons one of my Plugins contained a vendor folder with an earlier cake version. This caused the confusion. Sorry guys.
# Jul 5th 2021, 14:49 kevin.pfeifer I just enabled php 8.0 language level in my app and I have no issues whatsoever
# Jul 5th 2021, 14:40 dereuromark since that can be an issue for PHP8 named param usage, this is probably why it is visible here for u
# Jul 5th 2021, 14:39 dereuromark the error message suggests that somewhere in your code at least 1 of those is using "middleware" instead of "middlewareQueue" as var name.
# Jul 5th 2021, 14:39 dereuromark I both am, and for me this is not an issue. all good.
# Jul 5th 2021, 14:39 dereuromark also latest phpstorm?
# Jul 5th 2021, 14:36 jotpe 4.2
# Jul 5th 2021, 14:36 dereuromark are you on latest cake core?
# Jul 5th 2021, 14:36 jotpe Didn't solve the problem, I guess i'll just leave it.
# Jul 5th 2021, 14:34 jotpe Tried it, I guess I opened pandora's box...indexing :)
# Jul 5th 2021, 14:29 kevin.pfeifer sometimes phpstorm gets stuck on something and then the autocomplete/error messages are weid for me too
# Jul 5th 2021, 14:29 kevin.pfeifer have you tried `File` => `Invalidate Caches`?
# Jul 5th 2021, 14:27 jotpe Weird
# Jul 5th 2021, 14:26 jotpe it is @kevin.pfeifer
# Jul 5th 2021, 14:26 jotpe They're identical to the params in BaseApplication and HttpApplicationInterface
# Jul 5th 2021, 14:26 kevin.pfeifer I guess your `use X/Y/Z/MiddlewareQueue` is not `Cake\Http\MiddlewareQueue`
# Jul 5th 2021, 14:25 dereuromark but no big deal IMO
# Jul 5th 2021, 14:25 dereuromark most likely var name
# Jul 5th 2021, 14:23 jotpe
# Jul 5th 2021, 14:23 jotpe Anybody knows why PHPStorm is complaining about this?
# Jul 5th 2021, 13:58 jotpe Worked perfectly, ty
# Jul 5th 2021, 13:29 jotpe thanks @info315
# Jul 5th 2021, 13:28 jotpe @dereuromark you mean DbMaintenanceShell?
# Jul 5th 2021, 13:27 info315 @jotpe I convert my tables like so: https://github.com/it-novum/openITCOCKPIT/blob/development/UPDATE.sh#L123-L132
# Jul 5th 2021, 13:23 dereuromark I have custom scripts for that in Setup plugin that can help u
# Jul 5th 2021, 13:22 ndm IIRC that's not supported... you'll probably have to run custom raw `ALTER TABLE` SQL.
# Jul 5th 2021, 13:14 jotpe ```$authors = $this->table('authors', ['collation' => 'utf8mb4_unicode_ci']); $authors->update();```
# Jul 5th 2021, 13:14 jotpe Hey guys. I want to migrate some of my tables to use utf8mb4. This doesn't work. Any suggestions?
# Jul 5th 2021, 12:58 paolo.bragagni humm ok
# Jul 5th 2021, 12:48 kevin.pfeifer how about using the search? https://select2.org/data-sources/ajax
# Jul 5th 2021, 12:45 paolo.bragagni I'd like to retrieve the list via ajax
# Jul 5th 2021, 12:33 kevin.pfeifer https://select2.org/getting-started/basic-usage
# Jul 5th 2021, 12:21 paolo.bragagni some example somewhere?
# Jul 5th 2021, 12:13 paolo.bragagni qhere is select2
# Jul 5th 2021, 11:41 info315 inoas: true
# Jul 5th 2021, 11:24 inoas missing you on irc.libra.chat
# Jul 5th 2021, 09:58 kevin.pfeifer select2 or chosen is also a good JS library for that
# Jul 5th 2021, 09:54 dereuromark select2 for example
# Jul 5th 2021, 09:54 dereuromark Most autocomplete solutions have that built in, they can set the original field with the ID here.
# Jul 5th 2021, 09:53 erwane put it in a hidden field, comma separated list. Don't forget to unprotect the hidden field before or FormProtector will warn
# Jul 5th 2021, 09:20 paolo.bragagni the problem is that I dont know how to put the id (of lingua in this case) in my field so that it can save
# Jul 5th 2021, 09:18 paolo.bragagni and it shows correctly results in my 'lingue' field
# Jul 5th 2021, 09:17 paolo.bragagni for examplein my add for libri if I call doAc('lingua_id', 'Lingue' , 'title'); it checks for typing in my lingua_id field and it retrieve the id and the title (of Table Lingue)
# Jul 5th 2021, 09:13 paolo.bragagni my js works and it query with part of field
# Jul 5th 2021, 09:13 paolo.bragagni Hi in my add view I'd like to make an autocomplete for related fields (via js)
# Jul 4th 2021, 20:52 me1367 Yea.. though we'll see... I hope it'll be a relatively small one though... Mainly considering that the amount of big changes in CakePHP 7.4 and 8.0 is not too big...
# Jul 4th 2021, 20:49 kevin.pfeifer the fact that cake 5 will require php 8.0 will definitely be more cumbersome i think
# Jul 4th 2021, 20:49 kevin.pfeifer well, at least the jump from 3.x to 4.x is not that bad ,:)
# Jul 4th 2021, 20:45 me1367 Yea, though in all fairness... It's kinda my own fault for still not being on 4.x :^) Procastinating like a champ.
# Jul 4th 2021, 20:44 kevin.pfeifer the fact that cakephp 2.0 had support till now tells you, that you got enough time to migrate
# Jul 4th 2021, 20:44 kevin.pfeifer well sure, there is already a 5.0 branch here https://github.com/cakephp/cakephp/tree/5.0 But that doesn't mean, that its comming out next week and that cakephp 3 will be discarded in the next months
# Jul 4th 2021, 20:39 me1367 I'm barely done migrating to CakePHP 4 and 5 is already on it's way :| FML
# Jul 4th 2021, 12:36 ragnarog_online thank you
# Jul 4th 2021, 11:35 ndm @ragnarog_online Whenever you patch an association property it will be marked as dirty, no matter whether the nested data structure has any changes. It's not a bug, that is the intended behavior so that it is ensured that the ORM saving logic will run on the nested data. There might for example be `beforeSave()` callbacks for the nested data that would modify it, resulting a difference that needs to be saved, if the ORM would bail
# Jul 4th 2021, 11:35 slackebot2 out early because the association property isn't marked as dirty, then that functionality would be lost.
# Jul 4th 2021, 09:01 ragnarog_online SaveStrategy = replace
# Jul 4th 2021, 08:56 ragnarog_online hello, is this a bug? relations : SalesOrders hasMany SalesOrderBatches SalesOrderBatches hasMany SalesOrderDetails what makes sales_order_batches dirty?
# Jul 3rd 2021, 13:40 dereuromark I had the same thought^^
# Jul 3rd 2021, 13:15 kevin.pfeifer but thanks anyway for the help :bow:
# Jul 3rd 2021, 13:02 kevin.pfeifer yea, refactoring my whole search logic to the search plugin is on my list
# Jul 3rd 2021, 13:02 admad especially using the filter collections https://github.com/FriendsOfCake/search/tree/master/docs#filter-collection-classes
# Jul 3rd 2021, 13:01 admad might as well look into using foc/search since you are at it. It will make your code very clean.
# Jul 3rd 2021, 13:00 kevin.pfeifer i will do that
# Jul 3rd 2021, 13:00 admad remove *everything* related to the request :)
# Jul 3rd 2021, 12:59 kevin.pfeifer but yes, i can remove the request type check
# Jul 3rd 2021, 12:58 kevin.pfeifer well first it was all present in the controller and then i moved all that inside that finder method