Log message #4266779

# At Username Text
# Jun 29th 2021, 12:34 theblackbird.eu Hello, I'm struggling with urls in Cakephp 4 and hope someone can help. Due to how server is set up i have to use .htaccess to redirect everything for a domain from root folder to subdirectroy - i sadly can't change that. I have my .htaccess set up and it seems to be working: <https://pastebin.com/Nt6cXjiQ> Both app root and webdirectory .htaccess are default
# Jun 29th 2021, 12:33 kevin.pfeifer well If you don't use any other BelongsToMany associations with the same alias on multiple tables you should be fine
# Jun 29th 2021, 12:31 conehead it screws up other stuff. This is just one case I found
# Jun 29th 2021, 12:31 conehead My problem is not how to fix it...my problem is more that I don't know if
# Jun 29th 2021, 12:29 kevin.pfeifer why it works one way but not the other could be a bug
# Jun 29th 2021, 12:29 kevin.pfeifer I would guess the easiest solution for you would be to define one association as UserTags and one as BookTags
# Jun 29th 2021, 12:28 conehead And the targets differs. Both Tables use "Tags" and that is the reason why it does fail when finding through an association
# Jun 29th 2021, 12:26 conehead Yes
# Jun 29th 2021, 12:26 kevin.pfeifer well this only means, that there is an association present with the same alias but different targets or foreignkeys
# Jun 29th 2021, 12:21 conehead Not sure if it should be this way or if this breaks other stuff for me as well :(
# Jun 29th 2021, 12:20 conehead https://github.com/cakephp/cakephp/commit/1335605f8c68e7bac19cbc1028e6e7c7f2b479fa
# Jun 29th 2021, 12:03 conehead But the point is, it is working with the TableLocator, but not with the association. Just trying to find out what changed with cake 4.1
# Jun 29th 2021, 12:02 conehead Ah yes, the find is missing in the second
# Jun 29th 2021, 12:02 conehead Yes, Users and Books have "Tags" defined. There is no real custom configuration
# Jun 29th 2021, 11:58 dereuromark or 4.1 - but the 2nd one doesn't even issue a find(), that's weird.. this shouldn't even be working IMO
# Jun 29th 2021, 11:56 dereuromark 4.2 is a bit more strict. Looks like you defined it somewhere else already, and the plugin sets up its own relations by default. best to rename the custom ones you set up or remove them etc.
# Jun 29th 2021, 11:55 conehead Yes that behavior
# Jun 29th 2021, 11:53 kevin.pfeifer or is it a custom behavior you created?
# Jun 29th 2021, 11:50 kevin.pfeifer you mean from the behavior from this plugin? https://github.com/dereuromark/cakephp-tags
# Jun 29th 2021, 11:36 conehead Happens when upgrading from 4.0.5 to 4.1.7
# Jun 29th 2021, 11:33 erwane You can set defaultConnection in your Model table class. If your Datasource support SQL, yes, you can use the ORM but maybe it need a special driver.
# Jun 29th 2021, 11:33 conehead Both tables are using the Tags behaviorBoth tables are using the Tags behavior
# Jun 29th 2021, 11:33 conehead Hmm i just tried upgrading to Cake 4.2 and suddenly I get with my Tags plugin: "The existing `Tags` association on `Tagged` is incompatible with the `Tags` association on...`" This happens when I try to find an entity ```$this->Users->Books->find()->contain(['Tags'])->first(); // this does not work and I get the error TableRegistry::getTableLocator()->get('Books')->contain(['Tags'])->first(); // this does work```
# Jun 29th 2021, 11:14 paolo.bragagni ok thanks you are great
# Jun 29th 2021, 11:11 kevin.pfeifer as in the index.twig
# Jun 29th 2021, 11:11 kevin.pfeifer bellow you have basically the same foreach but just with the BelongsToMany https://github.com/cakephp/bake/blob/2.5.1/templates/bake/element/form.twig#L64
# Jun 29th 2021, 11:09 kevin.pfeifer ```{%- if fieldData.null %}``` just checks if the given field can be empty/null or not
# Jun 29th 2021, 11:09 ndm That check has nothing to do with associations, but whether the field is nullable
# Jun 29th 2021, 11:07 paolo.bragagni to desume that field is associated to some other table
# Jun 29th 2021, 11:07 paolo.bragagni {%- set fieldData = Bake.columnData(field, schema) %} {%- if fieldData.null %}
# Jun 29th 2021, 11:07 paolo.bragagni it checks
# Jun 29th 2021, 11:06 paolo.bragagni in form.twig the cicle is quite different
# Jun 29th 2021, 11:04 paolo.bragagni ok more or less I've understand BUT
# Jun 29th 2021, 11:02 kevin.pfeifer https://github.com/cakephp/bake/blob/2.5.1/templates/bake/Template/index.twig#L43
# Jun 29th 2021, 11:02 kevin.pfeifer well the details variable is part of the foreach a few lines above
# Jun 29th 2021, 11:00 paolo.bragagni uuuu. but I'd like to know where it set details.displayField
# Jun 29th 2021, 10:58 paolo.bragagni (I'm trying @ndm) :(
# Jun 29th 2021, 10:52 ndm Check what the built-in templates are doing: https://github.com/cakephp/bake/blob/2.5.1/templates/bake/Template/index.twig#L46
# Jun 29th 2021, 10:45 paolo.bragagni but how to get the name of the displayfield of associated model?
# Jun 29th 2021, 10:45 paolo.bragagni if I set {% set singFieldCapitalize=field[:-3]|capitalize %} I can get the name of associated Model
# Jun 29th 2021, 10:38 paolo.bragagni so inside the {%- if fieldData.null %} I get the field that are associated (someone please tell me why)